X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/93a18dd7a6b92922361383a4e6152380da5f3583..ca2f8cc7e93a21f9f04e0d976ca97feac4802e91:/uip/slocal.c diff --git a/uip/slocal.c b/uip/slocal.c index 2bf71fab..df02d0d1 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -26,9 +26,10 @@ #include #include #include +#include "h/done.h" #include -#include "../sbr/lock_file.h" -#include "../sbr/m_mktemp.h" +#include "sbr/lock_file.h" +#include "sbr/m_mktemp.h" #include #include @@ -636,7 +637,7 @@ usr_delivery (int fd, char *delivery, int su) } fclose (fp); - return (won ? 0 : -1); + return won ? 0 : -1; } @@ -931,13 +932,13 @@ logged_in (void) if (debug) continue; endutxent(); - return (utmped = DONE); + return utmped = DONE; } } endutxent(); #endif /* HAVE_GETUTXENT */ - return (utmped = NOTOK); + return utmped = NOTOK; } #define check(t,a,b) if (t < a || t > b) return -1 @@ -1046,7 +1047,7 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) { volatile int fd = fd_arg; pid_t child_id; - int i, bytes, seconds, status; + int bytes, seconds, status; struct stat st; if (verbose && !suppress) @@ -1054,9 +1055,7 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) lseek(fd, 0, SEEK_SET); - for (i = 0; (child_id = fork()) == -1 && i < 5; i++) - sleep (5); - + child_id = fork(); switch (child_id) { case -1: /* fork error */ @@ -1085,7 +1084,7 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) } #endif /* TIOCNOTTY */ - setpgid ((pid_t) 0, getpid ()); /* put in own process group */ + setpgid(0, getpid()); /* put in own process group */ *environ = NULL; setenv("USER", pw->pw_name, 1); @@ -1093,7 +1092,7 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) setenv("SHELL", pw->pw_shell, 1); execvp (pgm, vec); - _exit (-1); + _exit(1); default: /* parent process */ @@ -1123,7 +1122,7 @@ usr_pipe (int fd_arg, char *cmd, char *pgm, char **vec, int suppress) else pidstatus (status, stdout, ", failed"); } - return (status == 0 ? 0 : -1); + return status == 0 ? 0 : -1; } /* * Ruthlessly kill the child and anything @@ -1295,7 +1294,7 @@ fputs_error: static char * trim (char *cp) { - char buffer[BUFSIZ*4]; + static char buffer[BUFSIZ * 4]; char *bp, *sp; if (cp == NULL) @@ -1322,8 +1321,7 @@ trim (char *cp) if (isspace((unsigned char) *sp)) *sp = ' '; - /* now return a copy */ - return mh_xstrdup(bp); + return bp; } /*