X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1c91be5784ddebaa6a54f1f2c42a8016f10af6de..d6b2ae5fa68b9a82ffc006c233aef64c5cdb3bd2:/uip/slocal.c?ds=sidebyside diff --git a/uip/slocal.c b/uip/slocal.c index ff3cabf8..a26432c5 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -183,7 +183,7 @@ int main (int argc, char **argv) { int fd, status; - FILE *fp = stdin; + FILE *fp; char *cp, *mdlvr = NULL, buf[BUFSIZ]; char mailbox[BUFSIZ], tmpfil[BUFSIZ]; char **argp, **arguments; @@ -279,7 +279,9 @@ main (int argc, char **argv) adios (NULL, "no such local user as %s", user); if (chdir (pw->pw_dir) == -1) - chdir ("/"); + if (chdir ("/") < 0) { + advise ("/", "chdir"); + } umask (0077); if (geteuid() == 0) { @@ -1067,8 +1069,12 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) /* child process */ if (fd != 0) dup2 (fd, 0); - freopen ("/dev/null", "w", stdout); - freopen ("/dev/null", "w", stderr); + if (freopen ("/dev/null", "w", stdout) == NULL) { + advise ("stdout", "freopen"); + } + if (freopen ("/dev/null", "w", stderr) == NULL) { + advise ("stderr", "freopen"); + } if (fd != 3) dup2 (fd, 3); closefds (4);