shithub: nvi

Download patch

ref: 785d0c9f871d6d89d551ffb2184937264c6eec1f
parent: b7306bef352fc0796d84a5ef0bd5a301629adfe9
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Feb 4 12:27:30 EST 2022

pexec: instead of closing stderr, redirect it to /dev/null

--- a/util.c
+++ b/util.c
@@ -23,6 +23,7 @@
 pexec(void *args)
 {
 	Exec *e = args;
+	int fd;
 
 	if(e->p[0] >= 0){
 		dup(e->p[Them], 0);
@@ -33,8 +34,10 @@
 		close(0);
 		close(1);
 	}
-	if(debug < 1)
-		close(2);
+	if(debug < 1){
+		dup(fd = open("/dev/null", OWRITE), 2);
+		close(fd);
+	}
 	procexec(e->pid, e->file, e->argv);
 }