git://git.onelab.eu
/
util-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 0.30.214.
[util-vserver.git]
/
src
/
vlogin.c
diff --git
a/src/vlogin.c
b/src/vlogin.c
index
f42bfd3
..
ca75719
100644
(file)
--- a/
src/vlogin.c
+++ b/
src/vlogin.c
@@
-1,4
+1,4
@@
-// $Id: vlogin.c 2
325 2006-09-21 19:42:31
Z dhozac $
+// $Id: vlogin.c 2
525 2007-04-08 00:40:16
Z dhozac $
// Copyright (C) 2006 Benedikt Böhm <hollow@gentoo.org>
// Based on vserver-utils' vlogin program.
// Copyright (C) 2006 Benedikt Böhm <hollow@gentoo.org>
// Based on vserver-utils' vlogin program.
@@
-124,7
+124,7
@@
terminal_redraw(void)
}
/* copy terminal activities */
}
/* copy terminal activities */
-static
void
+static
ssize_t
terminal_copy(int src, int dst)
{
char buf[64];
terminal_copy(int src, int dst)
{
char buf[64];
@@
-137,10
+137,12
@@
terminal_copy(int src, int dst)
terminal_kill(SIGTERM);
exit(1);
} else if (len == -1)
terminal_kill(SIGTERM);
exit(1);
} else if (len == -1)
- return;
+ return
-1
;
/* write activity to user */
EwriteAll(dst, buf, len);
/* write activity to user */
EwriteAll(dst, buf, len);
+
+ return len;
}
/* shuffle all output, and reset the terminal */
}
/* shuffle all output, and reset the terminal */
@@
-276,11
+278,21
@@
void do_vlogin(int argc, char *argv[], int ind)
exit(wrapper_exit_code);
}
exit(wrapper_exit_code);
}
- if (FD_ISSET(STDIN_FILENO, &rfds))
- terminal_copy(STDIN_FILENO, t.fd);
+ 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))
- terminal_copy(t.fd, STDOUT_FILENO);
+ if (FD_ISSET(t.fd, &rfds)) {
+ /* EOF */
+ if (terminal_copy(t.fd, STDOUT_FILENO) == 0) {
+ terminal_kill(SIGHUP);
+ exit(0);
+ }
+ }
}
/* never get here, signal handler exits */
}
/* never get here, signal handler exits */