pwd.pw_gid = 0;
if ((fp = fopen(_PATH_PASSWD, "r")) == NULL) {
- perror(_PATH_PASSWD);
+ warn(_("%s: open failed"), _PATH_PASSWD);
return &pwd;
}
* If the encrypted password is valid or not found, return.
*/
if (p == NULL) {
- fprintf(stderr, _("%s: no entry for root\n"), _PATH_PASSWD);
+ warnx(_("%s: no entry for root\n"), _PATH_PASSWD);
return &pwd;
}
if (valid(pwd.pw_passwd))
}
#endif
execl(sushell, shell, NULL);
- perror(sushell);
+ warn(_("%s: exec failed"), sushell);
setenv("SHELL", "/bin/sh", 1);
execl("/bin/sh", profile ? "-sh" : "sh", NULL);
- perror("/bin/sh");
+ warn(_("%s: exec failed"), "/bin/sh");
}
static void usage(FILE *out)
if (tty || (tty = getenv("CONSOLE"))) {
if ((fd = open(tty, O_RDWR)) < 0) {
- perror(tty);
+ warn(_("%s: open failed"), tty);
fd = dup(0);
}
close(2);
if (fd > 2)
close(fd);
- if ((fd = open(tty, O_RDWR|O_NOCTTY)) < 0) {
- perror(tty);
- } else {
+ if ((fd = open(tty, O_RDWR|O_NOCTTY)) < 0)
+ warn(_("%s: open failed"), tty);
+ else {
ioctl(0, TIOCSCTTY, (char *)1);
tcsetpgrp(fd, ppgrp);
dup2(fd, 0);
/* We are init. We hence need to set a session anyway */
setsid();
if (ioctl(0, TIOCSCTTY, (char *)1))
- perror("ioctl(TIOCSCTTY)");
+ warn(_("TIOCSCTTY: ioctl failed"));
}
/*