aboutsummaryrefslogtreecommitdiff
path: root/sys/cluster/util-vserver/util-vserver-0.30.212.diff
blob: 8e5204c7d33a0e8a80949b944802572c1681aeec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: /src/vlogin.c
===================================================================
--- /src/vlogin.c (revision 2325)
+++ /src/vlogin.c (revision 2514)
@@ -125,5 +125,5 @@
 
 /* copy terminal activities */
-static void
+static ssize_t
 terminal_copy(int src, int dst)
 {
@@ -142,4 +142,6 @@
   /* write activity to user */
   EwriteAll(dst, buf, len);
+
+  return len;
 }
 
@@ -277,9 +279,19 @@
     }
 
-    if (FD_ISSET(STDIN_FILENO, &rfds))
-      terminal_copy(STDIN_FILENO, t.fd);
-
-    if (FD_ISSET(t.fd, &rfds))
-      terminal_copy(t.fd, STDOUT_FILENO);
+    if (FD_ISSET(STDIN_FILENO, &rfds)) {
+      /* EOF */
+      if (terminal_copy(STDIN_FILENO, t.fd) == 0) {
+	terminal_kill(SIGHUP);
+	exit(0);
+      }
+    }
+
+    if (FD_ISSET(t.fd, &rfds)) {
+      /* EOF */
+      if (terminal_copy(t.fd, STDOUT_FILENO) == 0) {
+	terminal_kill(SIGHUP);
+	exit(0);
+      }
+    }
   }