Skip to content

Commit 1b5a326

Browse files
anoopcs9kalebskeithley
authored andcommitted
Adapt to change in ftruncate API signature changes (#37)
Signed-off-by: Anoop C S <[email protected]>
1 parent 9eeea13 commit 1b5a326

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

configure.ac

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ AC_PROG_EGREP
3535

3636
# Dependencies
3737
AC_CHECK_HEADERS([readline/readline.h readline/history.h],,[AC_MSG_ERROR([cannot find readline headers])])
38-
PKG_CHECK_MODULES([GLFS], [glusterfs-api >= 3],,[AC_MSG_ERROR([cannot find glusterfs api headers])])
38+
PKG_CHECK_MODULES([GLFS], [glusterfs-api >= 3],[],[AC_MSG_ERROR([cannot find glusterfs api headers])])
39+
PKG_CHECK_MODULES([GLFS_7_6],[glusterfs-api >= 7.6],[AC_DEFINE(HAVE_GLFS_7_6,1,[found glusterfs api version >= 7.6])], [no])
3940

4041
AC_CHECK_PROG([HAVE_HELP2MAN],[help2man],[yes],[no])
4142
AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HAVE_HELP2MAN" = xyes])

src/glfs-cp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,11 @@ local_to_remote (const char *local_path, const char *remote_path, glfs_t *fs)
566566
error (0, errno, "failed to lock %s", full_path);
567567
goto out;
568568
}
569-
569+
#ifdef HAVE_GLFS_7_6
570+
ret = glfs_ftruncate (remote_fd, 0, NULL, NULL);
571+
#else
570572
ret = glfs_ftruncate (remote_fd, 0);
573+
#endif
571574
if (ret == -1) {
572575
error (0, errno, "failed to truncate %s", full_path);
573576
goto out;

src/glfs-mv.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,11 @@ local_to_remote (const char *local_path, const char *remote_path, glfs_t *fs)
567567
goto out;
568568
}
569569

570+
#ifdef HAVE_GLFS_7_6
571+
ret = glfs_ftruncate (remote_fd, 0, NULL, NULL);
572+
#else
570573
ret = glfs_ftruncate (remote_fd, 0);
574+
#endif
571575
if (ret == -1) {
572576
error (0, errno, "failed to truncate %s", full_path);
573577
goto out;

src/glfs-put.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ gluster_put (glfs_t *fs, struct state *state)
256256
goto out;
257257
}
258258
} else {
259+
#ifdef HAVE_GLFS_7_6
260+
ret = glfs_ftruncate (fd, 0, NULL, NULL);
261+
#else
259262
ret = glfs_ftruncate (fd, 0);
263+
#endif
260264
if (ret == -1) {
261265
error (0, errno, "truncate error: %s", filename);
262266
goto out;

0 commit comments

Comments
 (0)