aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-03-15 15:46:32 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-21 10:58:08 +0100
commita95cfdf48aa5102e16611360917c60b9354192fa (patch)
tree78c9e765a1db658ac01dc200f173242514531c41 /nx-X11/programs
parente96e810c2287232000767ee55f2d1b84b31e6291 (diff)
downloadnx-libs-a95cfdf48aa5102e16611360917c60b9354192fa.tar.gz
nx-libs-a95cfdf48aa5102e16611360917c60b9354192fa.tar.bz2
nx-libs-a95cfdf48aa5102e16611360917c60b9354192fa.zip
os: FatalError if -displayfd writes fail AND Clear the -displayfd option after closing the file
commit d72f691c0c9cace857975a6608a4cb431c8b6846 Author: Keith Packard <keithp@keithp.com> Date: Fri Apr 18 15:00:30 2014 -0700 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> commit 4957e986841225e9984daca76f1a0ee08df125bb Author: Keith Packard <keithp@keithp.com> Date: Fri Apr 18 15:00:35 2014 -0700 os: Clear the -displayfd option after closing the file Failing to clear this means that we'll attempt to write the display number to a random file descriptor on subsequent X server generations. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'nx-X11/programs')
-rw-r--r--nx-X11/programs/Xserver/os/connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 940b0bd75..8a5eb756a 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -364,8 +364,12 @@ NotifyParentProcess(void)
{
#if !defined(WIN32)
if (displayfd >= 0) {
- write(displayfd, display, strlen(display));
- close(displayfd);
+ 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;
}
if (RunFromSmartParent) {
if (ParentProcess > 1) {