mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* background.c (do_background): Fixed file descriptor leak.
This commit is contained in:
parent
243e84706e
commit
b86b6a7bc7
@ -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>
|
||||
|
||||
* Code cleanup: Added const qualifier for variables and
|
||||
|
@ -116,8 +116,13 @@ do_background (struct FileOpContext *ctx, char *info)
|
||||
if (pipe (comm) == -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;
|
||||
}
|
||||
|
||||
if (pid == 0) {
|
||||
int nullfd;
|
||||
|
Loading…
Reference in New Issue
Block a user