diff options
author | Keith Packard <keithp@keithp.com> | 2014-04-18 15:05:00 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-04-18 16:30:17 -0700 |
commit | 7abd28685066369ded807f59493c1159cfb286bf (patch) | |
tree | 89cbe71ea8b29b25c9f14680edc9f90e5a0a5b3e /os | |
parent | d72f691c0c9cace857975a6608a4cb431c8b6846 (diff) |
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>
Diffstat (limited to 'os')
-rw-r--r-- | os/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/os/utils.c b/os/utils.c index 6e6974e89..83d85cdda 100644 --- a/os/utils.c +++ b/os/utils.c @@ -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); |