1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

Do not block when trying to lock a PID file; fail immediately

This commit is contained in:
Moritz Grimm 2017-09-25 17:06:38 +02:00
parent 8cc45a3a3d
commit f5f130e036

View File

@ -168,7 +168,7 @@ util_write_pid_file(const char *path)
pid = getpid(); pid = getpid();
if (0 >= fprintf(pidfile_file, "%ld\n", (long)pid) || if (0 >= fprintf(pidfile_file, "%ld\n", (long)pid) ||
0 > fflush(pidfile_file) || 0 > fflush(pidfile_file) ||
0 > flock(fileno(pidfile_file), LOCK_EX)) 0 > flock(fileno(pidfile_file), LOCK_EX | LOCK_NB))
goto error; goto error;
if (0 == pidfile_numlocks) { if (0 == pidfile_numlocks) {