[torquedev] PBS Server not closing inherited files

Steve Snelgrove ssnelgrove at clusterresources.com
Wed Dec 5 10:42:18 MST 2007


I found a small bug in the PBS Server code in pbsd_init where
the sense of a compare was backwards.  The effect was that
the close inherited files loop never ran.  This is probably not
a big deal but should probably still be fixed.

In trying to correct this, I noticed that just changing the compare
did not work because prior to calling pbsd_init, main had already
opened the log file.  So this loop needs to be moved out to main.

The changes are shown below.  Should I go ahead and make this
correction?



ssnelgrove at makua:~/torque/2.2-fixes/src/server$ svn diff
Index: pbsd_init.c
===================================================================
--- pbsd_init.c (revision 1652)
+++ pbsd_init.c (working copy)
@@ -283,11 +283,6 @@
 
   setgroups(1,(gid_t *)&i);    /* secure suppl. groups */
 
-  i = sysconf(_SC_OPEN_MAX);
-
-  while (--i < 2)
-    close(i); /* close any file desc left open by parent */
-
 #ifndef DEBUG
 #ifdef _CRAY
   limit(C_JOB,      0,L_CPROC, 0);
Index: pbsd_main.c
===================================================================
--- pbsd_main.c (revision 1652)
+++ pbsd_main.c (working copy)
@@ -877,6 +877,11 @@
     return(1);
     }
 
+  i = sysconf(_SC_OPEN_MAX);
+  while (--i > 2)
+    close(i); /* close any file desc left open by parent */
+
+
   /* make sure no other server is running with this home directory */
 
   sprintf(lockfile,"%s/%s/server.lock",
s


More information about the torquedev mailing list