Permalink
Browse files

close pid files as early as possible in psadwatchd

  • Loading branch information...
mrash committed Feb 8, 2014
1 parent 9ef5930 commit 0d95d88e21adfd59a894a998db1e2e78dadba3db
Showing with 5 additions and 4 deletions.
  1. +5 −4 psadwatchd.c
View
@@ -229,18 +229,19 @@ static void check_process(
fprintf(stderr, "[-] Could not read the pid file: %s\n",
pid_file);
#endif
+ fclose(pidfile_ptr);
+
/* see if we need to give up */
incr_syscall_ctr(pid_name, max_retries);
- fclose(pidfile_ptr);
return;
}
- /* convert the pid_line into an integer */
- pid = atoi(pid_line);
-
/* close the pid_file now that we have read it */
fclose(pidfile_ptr);
+ /* convert the pid_line into an integer */
+ pid = atoi(pid_line);
+
if (kill(pid, 0) != 0) {
/* the process is not running so start it */
restart = 1;

0 comments on commit 0d95d88

Please sign in to comment.