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]) AX_CXX_COMPILE_STDCXX_11([noext])
AC_CHECK_LIB([mtp], [LIBMTP_Init], [], [AC_MSG_ERROR([libmtp not found])]) AC_CHECK_LIB([mtp], [LIBMTP_Init], [], [AC_MSG_ERROR([libmtp not found])])
AC_CHECK_HEADERS([libmtp.h]) AC_CHECK_HEADERS([libmtp.h])
AC_CHECK_FUNCS([fdatasync])
PKG_CHECK_MODULES([FUSE], [fuse >= 2.8]) PKG_CHECK_MODULES([FUSE], [fuse >= 2.8])
AC_SUBST([FUSE_CFLAGS]) 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, int SMTPFileSystem::fsync(const char *path, int datasync,
struct fuse_file_info *fi) 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) int SMTPFileSystem::opendir(const char *path, struct fuse_file_info *file_info)

View File

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

View File

@ -24,6 +24,7 @@
extern "C" { extern "C" {
# include <unistd.h> # include <unistd.h>
# include <sys/types.h> # include <sys/types.h>
# define _DARWIN_USE_64_BIT_INODE
# include <sys/stat.h> # include <sys/stat.h>
} }
#include "simple-mtpfs-fuse.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; struct stat file_stat;
stat64(src.c_str(), &file_stat); stat(src.c_str(), &file_stat);
TypeFile file_to_upload(0, dir_parent->id(), dir_parent->storageid(), TypeFile file_to_upload(0, dir_parent->id(), dir_parent->storageid(),
dst_basename, static_cast<uint64_t>(file_stat.st_size), 0); dst_basename, static_cast<uint64_t>(file_stat.st_size), 0);
LIBMTP_file_t *f = file_to_upload.toLIBMTPFile(); LIBMTP_file_t *f = file_to_upload.toLIBMTPFile();

View File

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