This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
master - liblogthread: Fix sefault if fopen() fails for any reason
- From: Lon Hohberger <lon at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Sat, 8 Nov 2008 02:09:40 +0000 (UTC)
- Subject: master - liblogthread: Fix sefault if fopen() fails for any reason
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=1145ef937c6b5e6a34e039c8f865f6a2086db15c
Commit: 1145ef937c6b5e6a34e039c8f865f6a2086db15c
Parent: 3de140ad461dadfd99eadd4d37bc9d53ffd1b741
Author: Lon Hohberger <lhh@redhat.com>
AuthorDate: Fri Nov 7 21:09:26 2008 -0500
Committer: Lon Hohberger <lhh@redhat.com>
CommitterDate: Fri Nov 7 21:09:26 2008 -0500
liblogthread: Fix sefault if fopen() fails for any reason
---
common/liblogthread/liblogthread.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c
index d7918f4..d8930aa 100644
--- a/common/liblogthread/liblogthread.c
+++ b/common/liblogthread/liblogthread.c
@@ -145,8 +145,10 @@ static void _conf(char *name, int mode, int facility, int priority, char *file)
if (logt_file_fp)
fclose(logt_file_fp);
logt_file_fp = fopen(logt_file, "a+");
- fd = fileno(logt_file_fp);
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
+ if (logt_file_fp != NULL) {
+ fd = fileno(logt_file_fp);
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
+ }
}
if (logt_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) {