mirror of
https://github.com/status-im/miniupnp.git
synced 2025-01-09 13:45:43 +00:00
Only remove pidfile if one was written in the first place
This commit is contained in:
parent
31d0dfa345
commit
70c5e194a3
@ -1,4 +1,7 @@
|
||||
$Id: Changelog.txt,v 1.264 2012/03/19 21:14:12 nanard Exp $
|
||||
$Id: Changelog.txt,v 1.265 2012/03/31 06:57:11 nanard Exp $
|
||||
|
||||
2012/03/31:
|
||||
Only remove pidfile if one was written in the first place.
|
||||
|
||||
2012/03/19:
|
||||
Fix ipfilter support (thanks dhowland https://github.com/dhowland)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: miniupnpd.c,v 1.147 2012/02/15 22:43:56 nanard Exp $ */
|
||||
/* $Id: miniupnpd.c,v 1.149 2012/03/31 06:57:12 nanard Exp $ */
|
||||
/* MiniUPnP project
|
||||
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
||||
* (c) 2006-2012 Thomas Bernard
|
||||
@ -1038,7 +1038,8 @@ init(int argc, char * * argv, struct runtime_vars * v)
|
||||
return 1;
|
||||
}
|
||||
|
||||
writepidfile(pidfilename, pid);
|
||||
if(writepidfile(pidfilename, pid) < 0)
|
||||
pidfilename = NULL;
|
||||
|
||||
#ifdef ENABLE_LEASEFILE
|
||||
/*remove(lease_file);*/
|
||||
@ -1711,7 +1712,7 @@ shutdown:
|
||||
close(snotify[i]);
|
||||
}
|
||||
|
||||
if(unlink(pidfilename) < 0)
|
||||
if(pidfilename && (unlink(pidfilename) < 0))
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to remove pidfile %s: %m", pidfilename);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user