gnustep-dev
[Top][All Lists]
Advanced

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

Re: bug in NSApplication


From: Adam Fedor
Subject: Re: bug in NSApplication
Date: Wed, 17 Jul 2002 20:02:17 -0600
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.0rc2) Gecko/20020513

Here's my gdomap patch. Anyone see anything wrong with it? It appears to work correctly.




--
Adam Fedor, Digital Optics Corp.      | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
                                      | know how I hate the stuff.
? autogsdoc
? gdomap.patch
? obj.lnk
? unknown.gsdocrefs
? make_strings/shared_debug_obj
Index: gdomap.c
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Tools/gdomap.c,v
retrieving revision 1.65.2.3
diff -u -r1.65.2.3 gdomap.c
--- gdomap.c    9 Jul 2002 07:27:02 -0000       1.65.2.3
+++ gdomap.c    18 Jul 2002 02:00:06 -0000
@@ -4535,6 +4535,27 @@
        }
     }
 
+  /* Write the pidfile, but only if the user is root */
+  if (pidfile && getuid () == 0 )
+    {
+      FILE     *fptr = fopen(pidfile, "at");
+
+      if (fptr == 0)
+       {
+         sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
+         gdomap_log(LOG_CRIT);
+         exit(1);
+       }
+      fprintf(fptr, "%d\n", (int) getpid());
+      fclose(fptr);
+      chmod(pidfile, 0644);
+    }
+  else if (pidfile)
+    {
+      sprintf(ebuf, "Only root user can write to pid file\n");
+      gdomap_log(LOG_WARNING);
+    }
+
 #ifndef __MINGW__
   /*
    * Try to become a 'safe' user now that we have
@@ -4568,21 +4589,6 @@
       setgroups (0, 0);        /* Empty additional groups list */
     }
 #endif /* __MINGW__ */
-
-  if (pidfile)
-    {
-      FILE     *fptr = fopen(pidfile, "at");
-
-      if (fptr == 0)
-       {
-         sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
-         gdomap_log(LOG_CRIT);
-         exit(1);
-       }
-      fprintf(fptr, "%d\n", (int) getpid());
-      fclose(fptr);
-      chmod(pidfile, 0644);
-    }
 
 #if    !defined(__svr4__)
   /*

reply via email to

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