bug-gnustep
[Top][All Lists]
Advanced

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

gnustep-base-1.3.4: gdomap doesn't close stderr in daemon mode


From: Matthias Klose
Subject: gnustep-base-1.3.4: gdomap doesn't close stderr in daemon mode
Date: Sun, 21 Jul 2002 13:12:40 +0200

patch attached. Is there a reason not to close stderr when running in
daemon mode?

--- gnustep-base-1.3.4.orig/Tools/gdomap.c
+++ gnustep-base-1.3.4/Tools/gdomap.c
@@ -4474,19 +4474,30 @@
    */
   for (c = 0; c < FD_SETSIZE; c++)
     {
-      if (c != 2)
+      if (is_daemon || (c != 2))
        {
          (void)close(c);
        }
     }
   if (open("/dev/null", O_RDONLY) != 0)
     {
-      perror("failed to open stdin from /dev/null\n");
+      sprintf(ebuf, "failed to open stdin from /dev/null (%s)",
+             strerror(errno));
+      gdomap_log(LOG_CRIT);
       exit(1);
     }
   if (open("/dev/null", O_WRONLY) != 1)
     {
-      perror("failed to open stdout from /dev/null\n");
+      sprintf(ebuf, "failed to open stdout from /dev/null (%s)",
+             strerror(errno));
+      gdomap_log(LOG_CRIT);
+      exit(1);
+    }
+  if (is_daemon && open("/dev/null", O_WRONLY) != 2)
+    {
+      sprintf(ebuf, "failed to open stderr from /dev/null (%s)",
+             strerror(errno));
+      gdomap_log(LOG_CRIT);
       exit(1);
     }
   if (debug)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]