diff --git a/NEWS b/NEWS index 30711472f14..de1139dea4e 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ documents those changes that are of interest to users and administrators. -- Fix sacct verbose about time and states queried. -- burst_buffer/cray - allow 'scancel --hurry ' to tear down a burst buffer that is currently staging data out. + -- X11 forwarding - allow setup if the DISPLAY environment variable lacks + a screen number. (Permit both "localhost:10.0" and "localhost:10".) * Changes in Slurm 18.08.5-2 ============================ diff --git a/src/common/x11_util.c b/src/common/x11_util.c index a0c03898fbb..c2c8b2a123f 100644 --- a/src/common/x11_util.c +++ b/src/common/x11_util.c @@ -95,6 +95,10 @@ extern int x11_get_display_port(void) exit(-1); } + /* + * Parse out port number + * Example: localhost/unix:89.0 or localhost/unix:89 + */ port_split = strchr(display, ':'); if (!port_split) { error("Error parsing DISPLAY environment variable. " @@ -102,14 +106,14 @@ extern int x11_get_display_port(void) exit(-1); } + /* + * Handle the "screen" portion of the display port. + * Xorg does not require a screen to be specified, defaults to 0. + */ port_split++; port_period = strchr(port_split, '.'); - if (!port_period) { - error("Error parsing DISPLAY environment variable. " - "Cannot use X11 forwarding."); - exit(-1); - } - *port_period = '\0'; + if (port_period) + *port_period = '\0'; port = atoi(port_split) + X11_TCP_PORT_OFFSET;