pkgsrc/security/libgcrypt/patches/patch-ab

32 lines
848 B
Text
Raw Normal View History

$NetBSD: patch-ab,v 1.1 2004/07/02 13:14:28 jmmv Exp $
--- cipher/rndunix.c.orig 2003-12-11 16:43:01.000000000 +0100
+++ cipher/rndunix.c
@@ -676,6 +676,15 @@ start_gatherer( int pipefd )
if( i != n1 && i != n2 && i != pipefd )
close(i);
}
+
+ /* Reopen standard files (only if needed) so that NetBSD does not
+ complain about executing set[ug]id programs with descriptors 0
+ and/or 1 closed. At this point, 2 is still open. */
+ if ((i = open("/dev/null", O_RDONLY)) != STDIN_FILENO)
+ close(i);
+ if ((i = open("/dev/null", O_WRONLY)) != STDOUT_FILENO)
+ close(i);
+
errno = 0;
}
@@ -703,6 +712,10 @@ start_gatherer( int pipefd )
#endif
fclose(stderr); /* Arrghh!! It's Stuart code!! */
+ {
+ int i = open("/dev/null", O_WRONLY);
+ assert(i == STDERR_FILENO);
+ }
for(;;) {
GATHER_MSG msg;