fix freebsd build

based on bugmen0t input
This commit is contained in:
Peter Hatina 2013-06-16 14:32:54 +02:00
parent 80b60dee24
commit f9c29169bb
5 changed files with 12 additions and 3 deletions

View File

@ -15,6 +15,7 @@ m4_include([m4/cxx11.m4])
AX_CXX_COMPILE_STDCXX_11([noext])
AC_CHECK_LIB([mtp], [LIBMTP_Init], [], [AC_MSG_ERROR([libmtp not found])])
AC_CHECK_HEADERS([libmtp.h])
AC_CHECK_FUNCS([fdatasync])
PKG_CHECK_MODULES([FUSE], [fuse >= 2.8])
AC_SUBST([FUSE_CFLAGS])

View File

@ -584,7 +584,12 @@ int SMTPFileSystem::flush(const char *path, struct fuse_file_info *file_info)
int SMTPFileSystem::fsync(const char *path, int datasync,
struct fuse_file_info *fi)
{
return datasync ? ::fdatasync(fi->fh) : ::fsync(fi->fh);
#ifdef HAVE_FDATASYNC
if (datasync)
return ::fdatasync(fi->fh);
else
#endif
return ::fsync(fi->fh);
}
int SMTPFileSystem::opendir(const char *path, struct fuse_file_info *file_info)

View File

@ -20,6 +20,7 @@
#include <memory>
#include <string>
#include <cstdlib>
extern "C" {
# include <fuse/fuse.h>
}

View File

@ -24,6 +24,7 @@
extern "C" {
# include <unistd.h>
# include <sys/types.h>
# define _DARWIN_USE_64_BIT_INODE
# include <sys/stat.h>
}
#include "simple-mtpfs-fuse.h"
@ -449,8 +450,8 @@ int MTPDevice::filePush(const std::string &src, const std::string &dst)
}
}
struct stat64 file_stat;
stat64(src.c_str(), &file_stat);
struct stat file_stat;
stat(src.c_str(), &file_stat);
TypeFile file_to_upload(0, dir_parent->id(), dir_parent->storageid(),
dst_basename, static_cast<uint64_t>(file_stat.st_size), 0);
LIBMTP_file_t *f = file_to_upload.toLIBMTPFile();

View File

@ -17,6 +17,7 @@
#include <config.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
extern "C" {
# include <libmtp.h>