Looks like the function is still buggy. The new problem now is that it should 
close the /proc directory before exits. The patch with the minor fix is:


--- timeoutd.c.orig     2010-03-08 16:19:50.000000000 +0100
+++ timeoutd.c  2010-03-08 16:19:57.000000000 +0100
@@ -1603,6 +1603,7 @@
                        proc_file = fopen(path, "r");
                        if(!proc_file) {
                                printf("error opening proc status file %s\n", 
path);
+                               closedir(proc); /* close /proc before 
leaving*/
                                return 0; /* no child exists */
                        }
                        while(!fscanf(proc_file, "PPid:    %s", akt_pid))
@@ -1610,9 +1611,13 @@

                        fclose(proc_file);

-                       if(atoi(akt_pid) == ppid)
+                       if(atoi(akt_pid) == ppid) {
+                               closedir(proc); /* close /proc before 
leaving*/
                                return (pid_t)atoi(cont->d_name); /* return 
pid of child */
+                       }
                } /* if(cont->d_type == 4) */
+
+       closedir(proc); /* close /proc before leaving*/

        return 0; /* no child found */
 } /* getchild(ppid) */

Hope I didn't miss something again...

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to