blob: 96a7271c69cf78d4ebcd700cbba4ed2d1b6fe6c3 [file] [log] [blame]
#include <unistd.h>
#include <fcntl.h>
#include "fdleak.h"
int main (int argc, char **argv)
{
int s1;
int s2;
CLOSE_INHERITED_FDS;
s1 = DO( open("/dev/null", O_RDONLY) );
s2 = DO( open("/dev/null", O_RDONLY) );
(void) DO( dup2(s1, 20) ); // dup s1 as fd 20
(void) DO( dup2(s1, s2) ); // dup s1 as fd s2, which closes existing s2 fd
return 0;
}