-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If there is a problem with reopening the logs, it can be an audit
trail issue. Make sure we log this in the syslog. Previously we were
trying to write this to the debug log that we just proved couldn't be
opened :-(

- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAky98IYACgkQeiVVYja6o6PzYgCfdy38nA9GRohEl6sh+Qk3oY81
2nsAn2y20/Z56zPXo8tMDAx0mBOCeWfX
=cdtq
-----END PGP SIGNATURE-----
From 91a9e3b54b951e8585c500277a686287baf72c62 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <[email protected]>
Date: Tue, 19 Oct 2010 15:11:10 -0400
Subject: [PATCH] Write log opening failures to the syslog

If there is a problem with reopening the logs, it can be an audit
trail issue.
---
 Makefile.am                |    2 +-
 src/monitor/monitor_sbus.c |    2 +-
 src/util/debug.c           |    3 +++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a5e6637c075a75a2f0f45ef8bf4c8734907899c7..65860b634e01b67aff30dabaa199a3fff0c2d7d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -504,8 +504,8 @@ sysdb_tests_LDADD = \
     libsss_test_common.la
 
 strtonum_tests_SOURCES = \
+    $(SSSD_DEBUG_OBJ) \
     src/tests/strtonum-tests.c \
-    src/util/debug.c \
     src/util/strtonum.c
 strtonum_tests_CFLAGS = \
     $(AM_CFLAGS) \
diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c
index 43e5b685e20a81858ee20d8951a4a24e85ac1cd8..034cd46d296f55956140265c164e7f7d17e1e796 100644
--- a/src/monitor/monitor_sbus.c
+++ b/src/monitor/monitor_sbus.c
@@ -184,7 +184,7 @@ int monitor_common_rotate_logs(DBusMessage *message,
 
     ret = rotate_debug_files();
     if (ret) {
-        DEBUG(1, ("Could not rotate debug files!\n"));
+        sss_log(SSS_LOG_ALERT, "Could not rotate debug files!\n");
         return ret;
     }
 
diff --git a/src/util/debug.c b/src/util/debug.c
index 5b6fccd684e78c5c189559bc10413f711b781e8e..30026dc11fb5d110419d3ff4cc544fa3ad01abb4 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -132,8 +132,11 @@ int open_debug_file_ex(const char *filename, FILE **filep)
     if (debug_file && !filep) fclose(debug_file);
 
     old_umask = umask(0177);
+    errno = 0;
     f = fopen(logpath, "a");
     if (f == NULL) {
+        sss_log(SSS_LOG_EMERG, "Could not open file [%s]. Error: [%d][%s]\n",
+                               logpath, errno, strerror(errno));
         free(logpath);
         return EIO;
     }
-- 
1.7.2.3

Attachment: 0001-Write-log-opening-failures-to-the-syslog.patch.sig
Description: PGP signature

_______________________________________________
sssd-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to