Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / security / libgcrypt / patches / patch-ab
blob63bde210f8b245f8af49cadb779272ce30b1c4cd
1 $NetBSD: patch-ab,v 1.3 2011/07/13 21:21:52 adam Exp $
3 --- random/rndunix.c.orig       2011-02-04 19:16:03.000000000 +0000
4 +++ random/rndunix.c
5 @@ -87,6 +87,7 @@
6  #include <stdlib.h>
7  #include <stdio.h>
8  #include <string.h>
9 +#include <assert.h>
11  /* OS-specific includes */
13 @@ -737,6 +738,15 @@ start_gatherer( int pipefd )
14             if( i != n1 && i != n2 && i != pipefd )
15                 close(i);
16         }
18 +       /* Reopen standard files (only if needed) so that NetBSD does not
19 +          complain about executing set[ug]id programs with descriptors 0
20 +          and/or 1 closed.  At this point, 2 is still open. */
21 +       if ((i = open("/dev/null", O_RDONLY)) != STDIN_FILENO)
22 +               close(i);
23 +       if ((i = open("/dev/null", O_WRONLY)) != STDOUT_FILENO)
24 +               close(i);
26         errno = 0;
27      }
29 @@ -764,6 +774,10 @@ start_gatherer( int pipefd )
30  #endif
32      fclose(stderr);            /* Arrghh!!  It's Stuart code!! */
33 +    {
34 +       int i = open("/dev/null", O_WRONLY);
35 +       assert(i == STDERR_FILENO);
36 +    }
38      for(;;) {
39         GATHER_MSG msg;