[git commit] getty: explain when setsid() fails. no code changes
Denys Vlasenko
vda.linux at googlemail.com
Sat May 10 22:00:52 UTC 2014
commit: http://git.busybox.net/busybox/commit/?id=539e2802ebd2680602de0a2c76069b7f555392d9
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
loginutils/getty.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 0f060ae..4b1b73b 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -556,6 +556,16 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
// pid, getppid(),
// getsid(0), getpgid(0));
bb_perror_msg_and_die("setsid");
+ /*
+ * When we can end up here?
+ * Example: setsid() fails when run alone in interactive shell:
+ * # getty 115200 /dev/tty2
+ * because shell's child (getty) is put in a new process group.
+ * But doesn't fail if shell is not interactive
+ * (and therefore doesn't create process groups for pipes),
+ * or if getty is not the first process in the process group:
+ * # true | getty 115200 /dev/tty2
+ */
}
/* Looks like we are already a session leader.
* In this case (setsid failed) we may still have ctty,
More information about the busybox-cvs
mailing list