diff options
author | Keith Packard <keithp@keithp.com> | 2014-04-18 15:00:30 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-04-18 16:30:17 -0700 |
commit | d72f691c0c9cace857975a6608a4cb431c8b6846 (patch) | |
tree | 10565127b4883d4e1f26b9bc9a961da535c5c496 /os | |
parent | 4957e986841225e9984daca76f1a0ee08df125bb (diff) |
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 <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'os')
-rw-r--r-- | os/connection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/os/connection.c b/os/connection.c index 5294e5955..40d9ff39b 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; } |