diff --git a/configure.ac b/configure.ac index 5c4978e..ce38fe4 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,8 @@ AC_PROG_EGREP # Dependencies AC_CHECK_HEADERS([readline/readline.h readline/history.h],,[AC_MSG_ERROR([cannot find readline headers])]) -PKG_CHECK_MODULES([GLFS], [glusterfs-api >= 3],,[AC_MSG_ERROR([cannot find glusterfs api headers])]) +PKG_CHECK_MODULES([GLFS], [glusterfs-api >= 3],[],[AC_MSG_ERROR([cannot find glusterfs api headers])]) +PKG_CHECK_MODULES([GLFS_7_6],[glusterfs-api >= 7.6],[AC_DEFINE(HAVE_GLFS_7_6,1,[found glusterfs api version >= 7.6])], [no]) AC_CHECK_PROG([HAVE_HELP2MAN],[help2man],[yes],[no]) AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HAVE_HELP2MAN" = xyes]) diff --git a/src/glfs-cp.c b/src/glfs-cp.c index 3edfcce..b778425 100644 --- a/src/glfs-cp.c +++ b/src/glfs-cp.c @@ -566,8 +566,11 @@ local_to_remote (const char *local_path, const char *remote_path, glfs_t *fs) error (0, errno, "failed to lock %s", full_path); goto out; } - +#ifdef HAVE_GLFS_7_6 + ret = glfs_ftruncate (remote_fd, 0, NULL, NULL); +#else ret = glfs_ftruncate (remote_fd, 0); +#endif if (ret == -1) { error (0, errno, "failed to truncate %s", full_path); goto out; diff --git a/src/glfs-mv.c b/src/glfs-mv.c index dfe1d91..cacd66d 100644 --- a/src/glfs-mv.c +++ b/src/glfs-mv.c @@ -567,7 +567,11 @@ local_to_remote (const char *local_path, const char *remote_path, glfs_t *fs) goto out; } +#ifdef HAVE_GLFS_7_6 + ret = glfs_ftruncate (remote_fd, 0, NULL, NULL); +#else ret = glfs_ftruncate (remote_fd, 0); +#endif if (ret == -1) { error (0, errno, "failed to truncate %s", full_path); goto out; diff --git a/src/glfs-put.c b/src/glfs-put.c index c253d81..e7be636 100644 --- a/src/glfs-put.c +++ b/src/glfs-put.c @@ -256,7 +256,11 @@ gluster_put (glfs_t *fs, struct state *state) goto out; } } else { +#ifdef HAVE_GLFS_7_6 + ret = glfs_ftruncate (fd, 0, NULL, NULL); +#else ret = glfs_ftruncate (fd, 0); +#endif if (ret == -1) { error (0, errno, "truncate error: %s", filename); goto out;