]> diplodocus.org Git - nmh/blobdiff - uip/slocal.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / slocal.c
index bd751a1f5c0880574f462340a88baf9f13a7359d..fe027ee2f8b3f00c3a44e722a154a42222a0d3a0 100644 (file)
@@ -27,8 +27,8 @@
 #include <h/tws.h>
 #include <h/mts.h>
 #include <h/utils.h>
-#include "../sbr/lock_file.h"
-#include "../sbr/m_mktemp.h"
+#include "sbr/lock_file.h"
+#include "sbr/m_mktemp.h"
 
 #include <pwd.h>
 #include <sys/ioctl.h>
@@ -1046,7 +1046,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 +1054,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 */
@@ -1295,7 +1293,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 +1320,7 @@ trim (char *cp)
        if (isspace((unsigned char) *sp))
            *sp = ' ';
 
-    /* now return a copy */
-    return mh_xstrdup(bp);
+    return bp;
 }
 
 /*