diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2015-10-01 16:16:52 -0400 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2015-10-28 16:34:45 -0700 |
commit | 36ea43b93b8476595ac22da031bc42a807ccc852 (patch) | |
tree | 314c44d79bdaea5f8e91676d0996b9313b5a843b /xlators/features/changelog/lib/src/gf-changelog-helpers.c | |
parent | 323e71617fee5020324540776d0d4469577f0afe (diff) |
core: use syscall wrappers instead of direct syscalls
various xlators and other components are invoking system calls
directly instead of using the libglusterfs/syscall.[ch] wrappers.
If not using the system call wrappers there should be a comment
in the source explaining why the wrapper isn't used.
Change-Id: I8ef94c48728666465abf126c778b70c9e5c00e47
BUG: 1267967
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/12273
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features/changelog/lib/src/gf-changelog-helpers.c')
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog-helpers.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-helpers.c b/xlators/features/changelog/lib/src/gf-changelog-helpers.c index d6245743437..8b35f4e9416 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-helpers.c +++ b/xlators/features/changelog/lib/src/gf-changelog-helpers.c @@ -11,10 +11,11 @@ #include "changelog-mem-types.h" #include "gf-changelog-helpers.h" #include "changelog-lib-messages.h" +#include "syscall.h" ssize_t gf_changelog_read_path (int fd, char *buffer, size_t bufsize) { - return read (fd, buffer, bufsize); + return sys_read (fd, buffer, bufsize); } size_t @@ -24,8 +25,7 @@ gf_changelog_write (int fd, char *buffer, size_t len) size_t written = 0; while (written < len) { - size = write (fd, - buffer + written, len - written); + size = sys_write (fd, buffer + written, len - written); if (size <= 0) break; @@ -81,7 +81,9 @@ static ssize_t my_read (read_line_t *tsd, int fd, char *ptr) { if (tsd->rl_cnt <= 0) { - if ( (tsd->rl_cnt = read (fd, tsd->rl_buf, MAXLINE)) < 0 ) + tsd->rl_cnt = sys_read (fd, tsd->rl_buf, MAXLINE); + + if (tsd->rl_cnt < 0) return -1; else if (tsd->rl_cnt == 0) return 0; @@ -154,7 +156,8 @@ gf_lseek (int fd, off_t offset, int whence) if (gf_readline_init_once (&tsd)) return -1; - if ( (off = lseek (fd, offset, whence)) == -1) + off = sys_lseek (fd, offset, whence); + if (off == -1) return -1; tsd->rl_cnt = 0; @@ -171,7 +174,7 @@ gf_ftruncate (int fd, off_t length) if (gf_readline_init_once (&tsd)) return -1; - if (ftruncate (fd, 0)) + if (sys_ftruncate (fd, 0)) return -1; tsd->rl_cnt = 0; |