diff options
-rw-r--r-- | lib/xwrap.c | 1 | ||||
-rw-r--r-- | toys/other/netcat.c | 1 | ||||
-rw-r--r-- | toys/pending/modprobe.c | 12 | ||||
-rw-r--r-- | toys/posix/nohup.c | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index b7eb2741..6216d918 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -94,6 +94,7 @@ void xprintf(char *format, ...) va_start(va, format); vprintf(format, va); + va_end(va); if (fflush(stdout) || ferror(stdout)) perror_exit("write"); } diff --git a/toys/other/netcat.c b/toys/other/netcat.c index 3c6f630b..485dda13 100644 --- a/toys/other/netcat.c +++ b/toys/other/netcat.c @@ -166,7 +166,6 @@ void netcat_main(void) if (!child && toys.optc) { int fd = pollfds[0].fd; - if (!temp) close(sockfd); dup2(fd, 0); dup2(fd, 1); if (toys.optflags&FLAG_L) dup2(fd, 2); diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c index cbf929b9..5431cb35 100644 --- a/toys/pending/modprobe.c +++ b/toys/pending/modprobe.c @@ -178,15 +178,21 @@ static int read_line(FILE *fl, char **li) line = NULL; linelen = nxtlinelen = 0; len = getline(&line, (size_t*)&linelen, fl); - if (len <= 0) return len; + if (len <= 0) { + free(line); + return len; + } // checking for commented lines. if (line[0] != '#') break; free(line); } for (;;) { if (line[len - 1] == '\n') len--; - // checking line continuation. - if (!len || line[len - 1] != '\\') break; + if (!len) { + free(line); + return len; + } else if (line[len - 1] != '\\') break; + len--; nxtlen = getline(&nxtline, (size_t*)&nxtlinelen, fl); if (nxtlen <= 0) break; diff --git a/toys/posix/nohup.c b/toys/posix/nohup.c index 0cece0b5..df264da2 100644 --- a/toys/posix/nohup.c +++ b/toys/posix/nohup.c @@ -28,8 +28,10 @@ void nohup_main(void) S_IRUSR|S_IWUSR )) { char *temp = getenv("HOME"); + temp = xmprintf("%s/%s", temp ? temp : "", "nohup.out"); xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, 0600); + free(temp); } } if (isatty(0)) { |