bugfix: initialize pid (as read from pidfile) to zero
If we didn't read any number from a pid file, we'll return an unitialized variable to the caller, and it will treat that garbage as a pid of a process (possible to kill). Fix that.
This commit is contained in:
parent
ec316aa32e
commit
cdf7f13c31
1 changed files with 1 additions and 1 deletions
|
@ -37,7 +37,7 @@
|
||||||
pid_t read_pid (char *pidfile)
|
pid_t read_pid (char *pidfile)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
long pid;
|
long pid = 0;
|
||||||
|
|
||||||
if (!(f=fopen(pidfile,"r")))
|
if (!(f=fopen(pidfile,"r")))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue