Skip to content

Commit

Permalink
Fix check for negative pid (#888)
Browse files Browse the repository at this point in the history
The pid variable is a pointer, and pointers cannot be negative. Fix
the check to test the value of the pid rather than the address of the
pointer.
  • Loading branch information
danielgustafsson committed May 13, 2022
1 parent e12223e commit ec5c3b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/pg_autoctl/pidfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ read_pidfile(const char *pidfile, pid_t *pid)

free(fileContents);

if (pid <= 0)
if (*pid <= 0)
{
log_debug("Read negative pid %d in file \"%s\", removing it",
*pid, pidfile);
Expand Down

0 comments on commit ec5c3b8

Please sign in to comment.