diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2015-10-01 16:28:58 -0400 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2015-11-16 06:18:10 -0800 |
commit | 2099cc875a4d20ab1bb12b1c33da16c95968e202 (patch) | |
tree | 78b611ee025511a06f28e8d5e63453f1dc5d8f1d /libglusterfs/src/statedump.c | |
parent | 3f0c70f2d56743707699f6a5b62a1c2c2d5c6f85 (diff) |
core: use syscall wrappers instead of direct syscalls - libglusterfs
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: Ieeca2d36adbc884e4cfa0026dba40df70310d40b
BUG: 1267967
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/12275
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs/src/statedump.c')
-rw-r--r-- | libglusterfs/src/statedump.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index fc66421be2f..caf228a8b01 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -15,6 +15,7 @@ #include "statedump.h" #include "stack.h" #include "common-utils.h" +#include "syscall.h" #ifdef HAVE_MALLOC_H @@ -73,7 +74,7 @@ gf_proc_dump_open (char *tmpname) static void gf_proc_dump_close (void) { - close (gf_dump_fd); + sys_close (gf_dump_fd); gf_dump_fd = -1; } @@ -131,7 +132,7 @@ gf_proc_dump_add_section_fd (char *key, va_list ap) GF_DUMP_MAX_BUF_LEN - strlen (buf), key, ap); snprintf (buf + strlen(buf), GF_DUMP_MAX_BUF_LEN - strlen (buf), "]\n"); - return write (gf_dump_fd, buf, strlen (buf)); + return sys_write (gf_dump_fd, buf, strlen (buf)); } @@ -184,7 +185,7 @@ gf_proc_dump_write_fd (char *key, char *value, va_list ap) offset = strlen (buf); snprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, "\n"); - return write (gf_dump_fd, buf, strlen (buf)); + return sys_write (gf_dump_fd, buf, strlen (buf)); } @@ -668,7 +669,7 @@ gf_proc_dump_parse_set_option (char *key, char *value) //None of dump options match the key, return back snprintf (buf, sizeof (buf), "[Warning]:None of the options " "matched key : %s\n", key); - ret = write (gf_dump_fd, buf, strlen (buf)); + ret = sys_write (gf_dump_fd, buf, strlen (buf)); if (ret >= 0) ret = -1; @@ -810,7 +811,7 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) timestr); //swallow the errors of write for start and end marker - ret = write (gf_dump_fd, sign_string, strlen (sign_string)); + ret = sys_write (gf_dump_fd, sign_string, strlen (sign_string)); memset (sign_string, 0, sizeof (sign_string)); memset (timestr, 0, sizeof (timestr)); @@ -857,12 +858,12 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) snprintf (sign_string, sizeof (sign_string), "\nDUMP-END-TIME: %s", timestr); - ret = write (gf_dump_fd, sign_string, strlen (sign_string)); + ret = sys_write (gf_dump_fd, sign_string, strlen (sign_string)); out: if (gf_dump_fd != -1) gf_proc_dump_close (); - rename (tmp_dump_name, path); + sys_rename (tmp_dump_name, path); GF_FREE (dump_options.dump_path); dump_options.dump_path = NULL; gf_proc_dump_unlock (); |