X font server does not like long PIDs

Stephan A. Maciej stephanm at datenfriedhof.net
Sat Mar 15 03:26:44 PDT 2008


Hi,

under Linux, you can set the maximum PID via doing

echo N >/proc/sys/kernel/pid_max

Typically, N is 32768, so that PIDs are 5 digits or less. The X font server 
relies on this and fails to daemonize if the decimal representation of 
getpid()'s return value is longer than 5 digits. The following patch fixes 
the problem for me. Diff is against xfs-1.0.4.

Stephan

diff -Nurb xfs-1.0.4.orig/os/utils.c xfs-1.0.4/os/utils.c
--- xfs-1.0.4.orig/os/utils.c	2006-11-30 18:50:41.000000000 +0100
+++ xfs-1.0.4/os/utils.c	2008-03-15 10:59:06.000000000 +0100
@@ -562,7 +562,7 @@
 		     strerror (errno));
 	    return -1;
 	}
-	if (fprintf (pidFilePtr, "%5ld\n", (long) getpid ()) != 6)
+	if (fprintf (pidFilePtr, "%11ld\n", (long) getpid ()) != 12)
 	{
 	    ErrorF ("cannot write to process-id file %s: %s\n", pidFile,
 		    strerror (errno));




More information about the xorg mailing list