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 <[email protected]>
---
 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;
     }
-- 
1.9.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to