Skip to content
Snippets Groups Projects
Commit a1c35107 authored by Sean Kennedy's avatar Sean Kennedy
Browse files

Fix fd dup tests to be more robust

i.e. not depending on the first fd to be 4.
parent 8ba70792
No related branches found
No related tags found
No related merge requests found
fd 4 duped into fd 5
duped fd is 1 greater than the original fd
fd 4 duped into fd 5
duped fd is 1 greater than the original fd
......@@ -19,7 +19,7 @@ int main(void) {
int newfd2 = fcntl(newfd, F_DUPFD, 0);
// TODO: The standard doesn't define errors for F_DUPFD
printf("fd %d duped into fd %d\n", newfd, newfd2);
printf("duped fd is %d greater than the original fd\n", newfd2 - newfd);
int c1 = close(newfd);
ERROR_IF(close, c1, == -1);
......
......@@ -17,7 +17,7 @@ int main(void) {
ERROR_IF(dup, fd2, == -1);
UNEXP_IF(dup, fd2, < 0);
printf("fd %d duped into fd %d\n", fd1, fd2);
printf("duped fd is %d greater than the original fd\n", fd2 - fd1);
int c1 = close(fd1);
ERROR_IF(close, c1, == -1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment