aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 35bacb748cd..f766e129593 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4557,17 +4557,20 @@ x_term_init (display_name)
4557 x_watch_cut_buffer_cache (); 4557 x_watch_cut_buffer_cache ();
4558#endif 4558#endif
4559 4559
4560 dup2 (ConnectionNumber (x_current_display), 0); 4560 if (ConnectionNumber (x_current_display) != 0)
4561 {
4562 dup2 (ConnectionNumber (x_current_display), 0);
4561 4563
4562#ifndef SYSV_STREAMS 4564#ifndef SYSV_STREAMS
4563 /* Streams somehow keeps track of which descriptor number 4565 /* Streams somehow keeps track of which descriptor number
4564 is being used to talk to X. So it is not safe to substitute 4566 is being used to talk to X. So it is not safe to substitute
4565 descriptor 0. But it is safe to make descriptor 0 a copy of it. */ 4567 descriptor 0. But it is safe to make descriptor 0 a copy of it. */
4566 close (ConnectionNumber (x_current_display)); 4568 close (ConnectionNumber (x_current_display));
4567 ConnectionNumber (x_current_display) = 0; /* Looks a little strange? 4569 ConnectionNumber (x_current_display) = 0; /* Looks a little strange?
4568 * check the def of the macro; 4570 * check the def of the macro;
4569 * it is a genuine lvalue */ 4571 * it is a genuine lvalue */
4570#endif /* SYSV_STREAMS */ 4572#endif /* SYSV_STREAMS */
4573 }
4571 4574
4572#endif /* ! defined (HAVE_X11) */ 4575#endif /* ! defined (HAVE_X11) */
4573 4576