aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-06-29 13:45:20 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-07-05 08:11:42 +0200
commitb5cceb740b60b62ab7d79c0ad4c00810b983efc5 (patch)
tree60064165c0629d919cb7b6b30fea84497f906544
parentbad0e8bdd32bf8bc741ad64a37a9318655f26068 (diff)
downloadnx-libs-b5cceb740b60b62ab7d79c0ad4c00810b983efc5.tar.gz
nx-libs-b5cceb740b60b62ab7d79c0ad4c00810b983efc5.tar.bz2
nx-libs-b5cceb740b60b62ab7d79c0ad4c00810b983efc5.zip
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> Backport to nx-libs: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
-rw-r--r--nx-X11/programs/Xserver/os/utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c
index f5f09c320..43d92ed98 100644
--- a/nx-X11/programs/Xserver/os/utils.c
+++ b/nx-X11/programs/Xserver/os/utils.c
@@ -411,7 +411,9 @@ LockServer(void)
if (lfd < 0)
FatalError("Could not create lock file in %s\n", tmp);
(void) sprintf(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);
+
#ifndef __UNIXOS2__
#ifndef USE_CHMOD
(void) fchmod(lfd, 0444);