Hide plumber output to prevent display cluttering - sacc - sacc(omys), simple console gopher client (HTM) git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags (DIR) LICENSE --- (DIR) commit e5ffdd3e259aafb40e46381e1093c942b5a91757 (DIR) parent 59f8f128f4fd5d7ec4efd6466da6c238cce9e2f9 (HTM) Author: Quentin Rameau <quinq@fifth.space> Date: Sun, 27 Aug 2017 13:26:31 +0200 Hide plumber output to prevent display cluttering Diffstat: M sacc.c | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) --- (DIR) diff --git a/sacc.c b/sacc.c @@ -25,6 +25,7 @@ static char *mainurl; static Item *mainentry; +static int devnullfd; static int parent = 1; void @@ -480,6 +481,8 @@ plumb(char *url) return; case 0: parent = 0; + dup2(devnullfd, 1); + dup2(devnullfd, 2); if (execlp(plumber, plumber, url, NULL) < 0) uistatus("execlp: plumb(%s): %s", url, strerror(errno)); } @@ -743,6 +746,8 @@ setup(void) { setenv("PAGER", "more", 0); atexit(cleanup); + if ((devnullfd = open("/dev/null", O_WRONLY)) < 0) + die("open: /dev/null: %s", strerror(errno)); if (mkdir("/tmp/sacc", S_IRWXU) < 0 && errno != EEXIST) die("mkdir: %s: %s", "/tmp/sacc", errno); uisetup();