public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* master - liblogthread: Fix sefault if fopen() fails for any reason
@ 2008-11-08  2:10 Lon Hohberger
  0 siblings, 0 replies; only message in thread
From: Lon Hohberger @ 2008-11-08  2:10 UTC (permalink / raw)
  To: cluster-cvs-relay

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) {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-08  2:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-08  2:10 master - liblogthread: Fix sefault if fopen() fails for any reason Lon Hohberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).