PR422261 platform selection fails for unqualified client name
[valgrind.git] / none / tests / fdleak_dup2.c
blob96a7271c69cf78d4ebcd700cbba4ed2d1b6fe6c3
1 #include <unistd.h>
2 #include <fcntl.h>
3 #include "fdleak.h"
5 int main (int argc, char **argv)
7 int s1;
8 int s2;
10 CLOSE_INHERITED_FDS;
12 s1 = DO( open("/dev/null", O_RDONLY) );
13 s2 = DO( open("/dev/null", O_RDONLY) );
15 (void) DO( dup2(s1, 20) ); // dup s1 as fd 20
16 (void) DO( dup2(s1, s2) ); // dup s1 as fd s2, which closes existing s2 fd
18 return 0;