summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorjwd <jwd@FreeBSD.org>2000-11-19 02:10:25 +0000
committerjwd <jwd@FreeBSD.org>2000-11-19 02:10:25 +0000
commit9c6b4db333692ded21cd0e118ef680cefb97d0d4 (patch)
treee8105a84410b59b0cb43e8d467e5339152122de0 /libexec
parentefaee5cdfcbee97e679b3159204a2b5512f4c951 (diff)
downloadFreeBSD-src-9c6b4db333692ded21cd0e118ef680cefb97d0d4.zip
FreeBSD-src-9c6b4db333692ded21cd0e118ef680cefb97d0d4.tar.gz
Check return code from login_tty. Allow getty to try and become
a daemon and session leader (thus allowing getty to be run from a shell command line or script). Partially Reviewed by: bde
Diffstat (limited to 'libexec')
-rw-r--r--libexec/getty/main.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index 68adab9..d812561 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -444,7 +444,18 @@ opentty(const char *ttyn, int flags)
return 0;
}
else {
- login_tty(i);
+ if (login_tty(i) < 0) {
+ if (daemon(0,0) < 0) {
+ syslog(LOG_ERR,"daemon: %m");
+ close(i);
+ return 0;
+ }
+ if (login_tty(i) < 0) {
+ syslog(LOG_ERR, "login_tty %s: %m", ttyn);
+ close(i);
+ return 0;
+ }
+ }
return 1;
}
}
OpenPOWER on IntegriCloud