Last active
July 8, 2016 02:07
-
-
Save rday/cb7957b871369c99bc5b2dff601d883d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Verify that single thread, unshared file descriptor tables are freed | |
*/ | |
#include <stdio.h> | |
#include <unistd.h> | |
void dupfds() | |
{ | |
int i, fd; | |
int fds[128]; | |
for (i=0; i<128; i++) { | |
fds[i] = dup(2); | |
if (fds[i]<0) { | |
perror("dup"); | |
} | |
} | |
for (i=0; i<128; i++) { | |
close(fds[i]); | |
} | |
} | |
int main() | |
{ | |
dupfds(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment