[PATCH 5/8] os: FatalError if -displayfd writes fail
Keith Packard
keithp at keithp.com
Fri Apr 18 15:21:52 PDT 2014
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 <keithp at keithp.com>
---
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
More information about the xorg-devel
mailing list