gdm file descriptor leak



GDM leaks a file descriptor every time the X server is restarted.  I
see no reason why GDM needs to keep the logfile open in the parent GDM
process, so the attached patch waits until just before starting X to
open the logfile.  This fixes the leak.

Where's gdm3?  I see a cvs dir for it, but nothing in it...

-- 
Ryan Murray, (rmurray cyberhqz com, rmurray debian org, rmurray stormix com)
Projects Manager, Stormix Technologies Inc., Debian Developer
The opinions expressed here are my own.
diff -ruN gdm-2.0beta4.orig/daemon/server.c gdm-2.0beta4/daemon/server.c
--- gdm-2.0beta4.orig/daemon/server.c	Fri Sep  8 23:52:00 2000
+++ gdm-2.0beta4/daemon/server.c	Fri Sep  8 23:51:12 2000
@@ -120,17 +120,6 @@
     sigaddset (&usr1mask, SIGUSR1);
     sigprocmask (SIG_UNBLOCK, &usr1mask, NULL);
     
-    /* Log all output from spawned programs to a file */
-    logfd = open (g_strconcat (GdmLogDir, "/", d->name, ".log", NULL),
-		  O_CREAT|O_TRUNC|O_APPEND|O_WRONLY, 0666);
-    
-    if (logfd != -1) {
-	dup2 (logfd, 1);
-	dup2 (logfd, 2);
-    }
-    else
-	gdm_error (_("gdm_server_start: Could not open logfile for display %s!"), d->name);
-    
     /* Just in case we have an old server hanging around */
     if (d->servpid) {
 	gdm_debug ("gdm_server_start: Old server found (%d). Killing.", d->servpid);
@@ -151,7 +140,18 @@
 	/* Close the XDMCP fd inherited by the daemon process */
 	if (GdmXdmcp)
 	    gdm_xdmcp_close();
+
+	/* Log all output from spawned programs to a file */
+	logfd = open (g_strconcat (GdmLogDir, "/", d->name, ".log", NULL),
+		      O_CREAT|O_TRUNC|O_APPEND|O_WRONLY, 0666);
 	
+	if (logfd != -1) {
+	    dup2 (logfd, 1);
+	    dup2 (logfd, 2);
+	}
+	else
+	    gdm_error (_("gdm_server_start: Could not open logfile for display %s!"), d->name);
+
 	/* The X server expects USR1 to be SIG_IGN */
 	usr1.sa_handler = SIG_IGN;
 	usr1.sa_flags = SA_RESTART;

Attachment: pgpIAzn7GhQwF.pgp
Description: PGP signature



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