* background.c (do_background): Fixed file descriptor leak.

This commit is contained in:
Roland Illig 2004-08-29 18:57:31 +00:00
parent 243e84706e
commit b86b6a7bc7
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2004-08-29 Roland Illig <roland.illig@gmx.de>
* background.c (do_background): Fixed file descriptor leak.
2004-08-29 Roland Illig <roland.illig@gmx.de> 2004-08-29 Roland Illig <roland.illig@gmx.de>
* Code cleanup: Added const qualifier for variables and * Code cleanup: Added const qualifier for variables and

View File

@ -116,8 +116,13 @@ do_background (struct FileOpContext *ctx, char *info)
if (pipe (comm) == -1) if (pipe (comm) == -1)
return -1; return -1;
if ((pid = fork ()) == -1) if ((pid = fork ()) == -1) {
int saved_errno = errno;
(void) close (comm[0]);
(void) close (comm[1]);
errno = saved_errno;
return -1; return -1;
}
if (pid == 0) { if (pid == 0) {
int nullfd; int nullfd;