diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2016-03-28 10:49:43 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2016-03-29 12:10:47 -0700 |
commit | 207289621f6c5b75bdb80aa14ddaf72efd5eb9b1 (patch) | |
tree | 3de601ceba14afb2683a63b580ae2c6f4b40e601 /libglusterfs | |
parent | 08d18ef9257067fac510af408665360019566000 (diff) |
libglusterfs: open cmd_history log file with O_APPEND and O_WRONLY
Commit 8fdfa0c introduced a fix to ensure cmd_history file is log rotated
properly. However with this fix fdopen() is called with mode "a" on a fd which
was not opened with O_WRONLY & O_APPEND resulting into a fdopen() failure.
Fix is to open cmd_history.log file with O_CREATE|O_WRONLY|O_APPEND mode
Change-Id: I75ef350560aa6d5435c78c5fd83adfde1a73bfc3
BUG: 1286959
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: http://review.gluster.org/13829
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/logging.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 62f19b9d3e3..c233aedc359 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -2440,7 +2440,7 @@ gf_cmd_log (const char *domain, const char *fmt, ...) } fd = open (ctx->log.cmd_log_filename, - O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR); + O_CREAT | O_WRONLY | O_APPEND, S_IRUSR | S_IWUSR); if (fd < 0) { gf_msg (THIS->name, GF_LOG_CRITICAL, errno, LG_MSG_FILE_OP_FAILED, "failed to open " |