From: Michael Tokarev Date: Mon, 18 May 2009 12:28:55 +0000 (+0400) Subject: bugfix: initialize pid (as read from pidfile) to zero X-Git-Tag: release-1.0.10~76 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=cdf7f13c31310da0c40819fd812e19519bf4318c;hp=ec316aa32e8567395a88c4583007f01ffae008ce 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. --- diff --git a/lib/pidfile.c b/lib/pidfile.c index 830d3f35..426cbf39 100644 --- a/lib/pidfile.c +++ b/lib/pidfile.c @@ -37,7 +37,7 @@ pid_t read_pid (char *pidfile) { FILE *f; - long pid; + long pid = 0; if (!(f=fopen(pidfile,"r"))) return 0;