From f4ed8e1224eb396f71a1c921ee2489a677deaa0d Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 18 Nov 2017 19:09:40 -0500 Subject: process spawning and forking: use dup2, not dup, in the child process. --- src/helper/slbt_archive_import.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/helper/slbt_archive_import.c') diff --git a/src/helper/slbt_archive_import.c b/src/helper/slbt_archive_import.c index 0d3ea52..c45efa4 100644 --- a/src/helper/slbt_archive_import.c +++ b/src/helper/slbt_archive_import.c @@ -65,9 +65,8 @@ static void slbt_archive_import_child( argv[2] = 0; close(fd[1]); - close(0); - if (dup(fd[0]) == 0) + if (dup2(fd[0],0) == 0) execvp(program,argv); _exit(EXIT_FAILURE); -- cgit v1.2.3