From d72f691c0c9cace857975a6608a4cb431c8b6846 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 18 Apr 2014 15:00:30 -0700 Subject: [PATCH] os: FatalError if -displayfd writes fail When the server is started with the -displayfd option, check to make sure that the writes succeed and give up running if they don't. Signed-off-by: Keith Packard Reviewed-by: Jamey Sharp --- os/connection.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/os/connection.c b/os/connection.c index 5294e59..40d9ff3 100644 --- a/os/connection.c +++ b/os/connection.c @@ -353,8 +353,10 @@ NotifyParentProcess(void) { #if !defined(WIN32) if (displayfd >= 0) { - write(displayfd, display, strlen(display)); - write(displayfd, "\n", 1); + if (write(displayfd, display, strlen(display)) != strlen(display)) + FatalError("Cannot write display number to fd %d\n", displayfd); + if (write(displayfd, "\n", 1) != 1) + FatalError("Cannot write display number to fd %d\n", displayfd); close(displayfd); displayfd = -1; } -- 2.7.4