os: Make sure that writing our pid to the lock file actually worked
There's no sense verifying that we can create the lock file and then ignoring the return value from write. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
This commit is contained in:
parent
d72f691c0c
commit
7abd286850
|
@ -313,7 +313,8 @@ LockServer(void)
|
|||
if (lfd < 0)
|
||||
FatalError("Could not create lock file in %s\n", tmp);
|
||||
snprintf(pid_str, sizeof(pid_str), "%10ld\n", (long) getpid());
|
||||
(void) write(lfd, pid_str, 11);
|
||||
if (write(lfd, pid_str, 11) != 11)
|
||||
FatalError("Could not write pid to lock file in %s\n", tmp);
|
||||
(void) fchmod(lfd, 0444);
|
||||
(void) close(lfd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user