* Old PID files are already checked via checkforrunning() and exits if process found so we don't need O_EXCL in writepidfile() and can instead just overwrite. Also fix permissions as well to not give world write access. Thanks to Alan Swanson.

This commit is contained in:
Justin Maggard 2011-02-15 02:46:28 +00:00
parent fdde0303ca
commit df2b72ada5

View File

@ -93,7 +93,7 @@ writepidfile(const char * fname, int pid)
if(!fname || (strlen(fname) == 0))
return -1;
if( (pidfile = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0)
if( (pidfile = open(fname, O_WRONLY|O_CREAT, 0644)) < 0)
{
DPRINTF(E_ERROR, L_GENERAL, "Unable to open pidfile for writing %s: %s\n", fname, strerror(errno));
return -1;