aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/os/connection.c
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2017-03-15 15:05:18 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-03-21 10:58:08 +0100
commit3be144ffde5f35df21ad115cbdedb8a072420edb (patch)
tree7e287ed4fc9517dd86811c2f431a369aa7f9fe47 /nx-X11/programs/Xserver/os/connection.c
parent506aedbcd3f56cf255b397f1e586f16f97e3619a (diff)
downloadnx-libs-3be144ffde5f35df21ad115cbdedb8a072420edb.tar.gz
nx-libs-3be144ffde5f35df21ad115cbdedb8a072420edb.tar.bz2
nx-libs-3be144ffde5f35df21ad115cbdedb8a072420edb.zip
Handle -displayfd and an explicit display number sensibly
commit bc348bd2c42f3f18786085ccef2f010eff5bf3d2 Author: Jon TURNEY <jon.turney@dronecode.org.uk> Date: Mon Mar 11 14:34:32 2013 +0000 Handle -displayfd and an explicit display number sensibly Handle -displayfd and an explicit display number sensibly, e.g. use the explicitly specified display number, and write it to the displayfd v2: displayfd might be 0, so use -1 as invalid value v3: Rebase for addition of NoListenAll flag Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Backported-to-NX-by: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Diffstat (limited to 'nx-X11/programs/Xserver/os/connection.c')
-rw-r--r--nx-X11/programs/Xserver/os/connection.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c
index 8958c47b5..7638cdfdd 100644
--- a/nx-X11/programs/Xserver/os/connection.c
+++ b/nx-X11/programs/Xserver/os/connection.c
@@ -361,8 +361,8 @@ void
NotifyParentProcess(void)
{
#if !defined(WIN32)
- if (dynamic_display[0]) {
- write(displayfd, dynamic_display, strlen(dynamic_display));
+ if (displayfd >= 0) {
+ write(displayfd, display, strlen(display));
close(displayfd);
}
if (RunFromSmartParent) {
@@ -410,18 +410,17 @@ CreateWellKnownSockets(void)
FD_ZERO (&WellKnownConnections);
/* display is initialized to "0" by main(). It is then set to the display
- * number if specified on the command line, or to NULL when the -displayfd
- * option is used. */
+ * number if specified on the command line. */
if (NoListenAll) {
ListenTransCount = 0;
}
- else if (display) {
+ else if ((displayfd < 0) || explicit_display) {
if (TryCreateSocket(atoi(display), &partial) &&
ListenTransCount >= 1)
if (!PartialNetwork && partial)
FatalError ("Failed to establish all listening sockets");
}
- else { /* -displayfd */
+ else { /* -displayfd and no explicit display number */
Bool found = 0;
for (i = 0; i < 65535 - X_TCP_PORT; i++) {
if (TryCreateSocket(i, &partial) && !partial) {