]> diplodocus.org Git - nmh/blobdiff - uip/slocal.c
Merge commit '8206fbf', due to my screwup of committing it on a detached
[nmh] / uip / slocal.c
index ff3cabf87bf7e4834c72489b8200a4b59cdddcd5..a26432c5da36e53f27b6bfc8fec02c770d411f8d 100644 (file)
@@ -183,7 +183,7 @@ int
 main (int argc, char **argv)
 {
     int fd, status;
 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;
     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)
        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) {
     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);
            /* 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);
            if (fd != 3)
                dup2 (fd, 3);
            closefds (4);