X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=lib%2Fpidfile.c;h=47f6359f6ed2da73409b683ccabaaac6b2cd24a2;hp=830d3f358d6a08c65404f193b89e1e9a6066b879;hb=95a6974de173e0cb78611c6704ed09631d510dae;hpb=ab6f76f6a9fc8028fff96322a52b770710ffa1a9 diff --git a/lib/pidfile.c b/lib/pidfile.c index 830d3f35..47f6359f 100644 --- a/lib/pidfile.c +++ b/lib/pidfile.c @@ -14,9 +14,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* left unaltered for tinc -- Ivo Timmermans */ @@ -41,7 +41,8 @@ pid_t read_pid (char *pidfile) if (!(f=fopen(pidfile,"r"))) return 0; - fscanf(f,"%ld", &pid); + if(fscanf(f,"%ld", &pid) != 1) + pid = 0; fclose(f); return pid; }