Skip to content

Commit

Permalink
Adapt to change in ftruncate API signature changes (#37)
Browse files Browse the repository at this point in the history
Signed-off-by: Anoop C S <[email protected]>
  • Loading branch information
anoopcs9 authored and kalebskeithley committed Aug 1, 2019
1 parent 9eeea13 commit 1b5a326
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
5 changes: 4 additions & 1 deletion src/glfs-cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/glfs-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/glfs-put.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1b5a326

Please sign in to comment.