[master 2/3] modules.c: only log from _doLoadModule() if logging has been initialized.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So one can call _doLoadModule() from init.c.
---
 loader/modules.c      |    8 ++++++--
 pyanaconda/isys/log.c |    6 ++++++
 pyanaconda/isys/log.h |    1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/loader/modules.c b/loader/modules.c
index fd1b2a0..cf69969 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -201,12 +201,16 @@ static gboolean _doLoadModule(const gchar *module, gchar **args) {
         gint fd = -1;
 
         if ((argv = g_malloc0(3 * sizeof(*argv))) == NULL) {
-            logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
+            if (loggingReady()) {
+                logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
+            }
             abort();
         }
 
         if ((fd = open("/dev/tty3", O_RDWR)) == -1) {
-            logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
+            if (loggingReady()) {
+                logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
+            }
         } else {
             dup2(fd, 0);
             dup2(fd, 1);
diff --git a/pyanaconda/isys/log.c b/pyanaconda/isys/log.c
index 574d436..96da57e 100644
--- a/pyanaconda/isys/log.c
+++ b/pyanaconda/isys/log.c
@@ -222,4 +222,10 @@ int getLogLevel(void) {
     return minLevel;
 }
 
+/* returns non-null if logging has been initialized */
+int loggingReady(void)
+{
+    return main_log_tty != NULL;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4: */
diff --git a/pyanaconda/isys/log.h b/pyanaconda/isys/log.h
index 51de2de..88d0010 100644
--- a/pyanaconda/isys/log.h
+++ b/pyanaconda/isys/log.h
@@ -44,6 +44,7 @@ void openLog();
 void closeLog(void);
 void setLogLevel(int minLevel);
 int getLogLevel(void);
+int loggingReady(void);
 
 extern int tty_logfd;
 extern int file_logfd;
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux