commit f4f4176747a1288201a54070fc121ef588fc887b
Author: André Majorel <amajorel@teaser.fr>
Date:   Wed Mar 15 13:58:44 2006 +0100

    Check for not-logging before writing to the log file
    
    Fixes a segfault when the $CWD is on a read-only filesystem.

--- src/log.c
+++ src/log.c
@@ -40,10 +40,10 @@ int lopen (void)
 {
   if (logfp == &nolog)
     return 1;
-  if (logfp == NULL)
+  if (logfp == NULL || logfp == &nolog)
   {
     logfp = fopen (logfile, "w");
-    if (logfp == NULL)
+    if (logfp == NULL || logfp == &nolog)
     {
       /* Can't use Warning(), we would loop. */
       fflush (stdout);
@@ -65,7 +65,7 @@ int lopen (void)
  */
 void lputc (char c)
 {
-  if (logfp == NULL)
+  if (logfp == NULL || logfp == &nolog)
     return;
   fputc (c, logfp);
   fflush (logfp);  /* We don't want a segfault to truncate the log */
@@ -77,7 +77,7 @@ void lputc (char c)
  */
 void lputs (const char *str)
 {
-  if (logfp == NULL)
+  if (logfp == NULL || logfp == &nolog)
     return;
   fputs (str, logfp);
   fflush (logfp);  /* We don't want a segfault to truncate the log */
@@ -91,7 +91,7 @@ void lprintf (const char *fmt, ...)
 {
   va_list list;
 
-  if (logfp == NULL)
+  if (logfp == NULL || logfp == &nolog)
     return;
   va_start (list, fmt);
   vlprintf (fmt, list);
@@ -104,7 +104,7 @@ void lprintf (const char *fmt, ...)
  */
 void vlprintf (const char *fmt, va_list list)
 {
-  if (logfp == NULL)
+  if (logfp == NULL || logfp == &nolog)
     return;
   vfprintf (logfp, fmt, list);
   fflush (logfp);  /* We don't want a segfault to truncate the log */
