From b5cceb740b60b62ab7d79c0ad4c00810b983efc5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 29 Jun 2016 13:45:20 +0200 Subject: 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 Reviewed-by: Jamey Sharp Backport to nx-libs: Mike Gabriel --- nx-X11/programs/Xserver/os/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/os') 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); -- cgit v1.2.3