|
|
12a457 |
From d06844826999b2306dec61745acd8d7f8b51dba1 Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
Date: Mon, 28 Mar 2016 10:49:43 +0530
|
|
|
12a457 |
Subject: [PATCH 36/80] libglusterfs: open cmd_history log file with O_APPEND and O_WRONLY
|
|
|
12a457 |
|
|
|
12a457 |
Backport of http://review.gluster.org/13829
|
|
|
12a457 |
http://review.gluster.org/13847
|
|
|
12a457 |
|
|
|
12a457 |
Commit 8fdfa0c introduced a fix to ensure cmd_history file is log rotated
|
|
|
12a457 |
properly. However with this fix fdopen() is called with mode "a" on a fd which
|
|
|
12a457 |
was not opened with O_WRONLY & O_APPEND resulting into a fdopen() failure.
|
|
|
12a457 |
|
|
|
12a457 |
Fix is to open cmd_history.log file with O_CREATE|O_WRONLY|O_APPEND mode
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I75ef350560aa6d5435c78c5fd83adfde1a73bfc3
|
|
|
12a457 |
BUG: 1321509
|
|
|
12a457 |
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
Reviewed-on: http://review.gluster.org/13829
|
|
|
12a457 |
Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
Reviewed-by: Niels de Vos <ndevos@redhat.com>
|
|
|
12a457 |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/71161
|
|
|
12a457 |
Tested-by: Niels de Vos <ndevos@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
libglusterfs/src/logging.c | 2 +-
|
|
|
12a457 |
1 files changed, 1 insertions(+), 1 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
|
|
|
12a457 |
index 0d44803..04b44b8 100644
|
|
|
12a457 |
--- a/libglusterfs/src/logging.c
|
|
|
12a457 |
+++ b/libglusterfs/src/logging.c
|
|
|
12a457 |
@@ -2443,7 +2443,7 @@ gf_cmd_log (const char *domain, const char *fmt, ...)
|
|
|
12a457 |
}
|
|
|
12a457 |
|
|
|
12a457 |
fd = open (ctx->log.cmd_log_filename,
|
|
|
12a457 |
- O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR);
|
|
|
12a457 |
+ O_CREAT | O_WRONLY | O_APPEND, S_IRUSR | S_IWUSR);
|
|
|
12a457 |
if (fd < 0) {
|
|
|
12a457 |
gf_msg (THIS->name, GF_LOG_CRITICAL, errno,
|
|
|
12a457 |
LG_MSG_FILE_OP_FAILED, "failed to open "
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|