Menu

#3 Multiple bugs in PADS 1.2 in daemon mode under RHEL 4

release
open
5
2007-06-14
2007-06-05
No

While trying to deploy PADS 1.2 on a RedHat Enterprise Linux 4 system, I encountered multiple bugs having to do with daemon mode.

1) Stdout/Stderr are not flushed before child process closes them. Due to buffering, the standard output messages are not fully written to the terminal before the child forks off, and when they are flushed later, stdout and stderr are already closed, resulting in a segfault.

2) Setting the PID filename in the config file works, but if no name is explicitly set, the code fails to correctly set the default "/var/run/pads.pid". Instead, the value is a NULL pointer, which causes the init_pid_file() function to segfault when it tries to create the file.

3) The init_pid_file() function is called by the child, but for some reason it always has the parent PID in it, which is incorrect.

I'm attaching a patch that contains fixes for all three issues. It explicitly flushes stderr & stdout just before closing them in the child. It contains a reworked init_pid_file() function that correctly handles the pid file name in all cases. Finally, I moved the invocation of init_pid_file() into the daemonize() function, so that the PID file would contain the child's PID.

Discussion

  • David J. Bianco

    David J. Bianco - 2007-06-05

    Patch for PADS 1.2

     
  • Matt Shelton

    Matt Shelton - 2007-06-14
    • assigned_to: nobody --> mattshelton
     

Log in to post a comment.