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/logging.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/logging.c')
-rw-r--r-- | libglusterfs/src/logging.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 7081b184de9..03f5ff89733 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -26,6 +26,8 @@ #include <sys/stat.h> +#include "syscall.h" + #define GF_JSON_MSG_LENGTH 8192 #define GF_SYSLOG_CEE_FORMAT \ "@cee: {\"msg\": \"%s\", \"gf_code\": \"%u\", \"gf_message\": \"%s\"}" @@ -369,7 +371,7 @@ gf_log_rotate(glusterfs_ctx_t *ctx) "logfile"); return; } - close (fd); + sys_close (fd); new_logfile = fopen (ctx->log.filename, "a"); if (!new_logfile) { @@ -689,7 +691,7 @@ gf_log_init (void *data, const char *file, const char *ident) gf_openlog (NULL, -1, LOG_DAEMON); } /* TODO: make FACILITY configurable than LOG_DAEMON */ - if (stat (GF_LOG_CONTROL_FILE, &buf) == 0) { + if (sys_stat (GF_LOG_CONTROL_FILE, &buf) == 0) { /* use syslog logging */ ctx->log.log_control_file_found = 1; } else { @@ -741,7 +743,7 @@ gf_log_init (void *data, const char *file, const char *ident) " \"%s\" (%s)\n", file, strerror (errno)); return -1; } - close (fd); + sys_close (fd); ctx->log.logfile = fopen (file, "a"); if (!ctx->log.logfile) { @@ -1234,7 +1236,7 @@ _gf_msg_nomem (const char *domain, const char *file, /* write directly to the fd to prevent out of order * message and stack */ - ret = write (fd, msg, wlen); + ret = sys_write (fd, msg, wlen); if (ret == -1) { pthread_mutex_unlock (&ctx->log.logfile_mutex); goto out; @@ -2179,7 +2181,7 @@ _gf_log (const char *domain, const char *file, const char *function, int line, "failed to open logfile"); return -1; } - close (fd); + sys_close (fd); new_logfile = fopen (ctx->log.filename, "a"); if (!new_logfile) { @@ -2353,7 +2355,7 @@ gf_cmd_log_init (const char *filename) LG_MSG_FILE_OP_FAILED, "failed to open cmd_log_file"); return -1; } - close (fd); + sys_close (fd); ctx->log.cmdlogfile = fopen (ctx->log.cmd_log_filename, "a"); if (!ctx->log.cmdlogfile){ |