diff --git a/pkin/pkin/pkin_pkg_fetch_start.c b/pkin/pkin/pkin_pkg_fetch_start.c index 6e963d0..887bad3 100644 --- a/pkin/pkin/pkin_pkg_fetch_start.c +++ b/pkin/pkin/pkin_pkg_fetch_start.c @@ -1,4 +1,5 @@ #include +#include #include #include #include "../pkin.h" @@ -7,6 +8,7 @@ int pkin_fetch_start(pkin_fetch_queue *queue) { char **fetchcmd; + int nullfd; pid_t pid; if (buffer_flush(&queue->writeb) < 0) { carpsys("write to pipe"); @@ -15,13 +17,16 @@ int pkin_fetch_start(pkin_fetch_queue *queue) close(queue->pipefd[1]); fetchcmd = (char *[]){"aria2c", "-i", "-", NULL}; - pid = pkin__spawn(fetchcmd, queue->pipefd[0], 1, 2); + nullfd = open_write("/dev/null"); + pid = pkin__spawn(fetchcmd, queue->pipefd[0], nullfd < 0 ? 1 : nullfd, 2); if (pid < 0) { + close(nullfd); carp("failed spawning aria2c to fetch files"); return 0; } if (waitpid(pid, NULL, 0) < 0) { + close(nullfd); carp("waitpid"); return 0; }