mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
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
This commit is contained in:
parent
aecbd99950
commit
46ee285632
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=68888
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user