Commit b0aa868d authored by Pavel Emelyanov's avatar Pavel Emelyanov

zdtm: Add test for close-on-exec bits

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 05e3c4d2
...@@ -43,6 +43,7 @@ int main(int argc, char **argv) ...@@ -43,6 +43,7 @@ int main(int argc, char **argv)
if (pid == -1) if (pid == -1)
return 1; return 1;
else if (pid) { else if (pid) {
fcntl(fd2, F_SETFD, 1);
test_waitsig(); test_waitsig();
off = lseek(fd, OFFSET, SEEK_SET); off = lseek(fd, OFFSET, SEEK_SET);
if (off == (off_t) -1) if (off == (off_t) -1)
...@@ -77,6 +78,19 @@ int main(int argc, char **argv) ...@@ -77,6 +78,19 @@ int main(int argc, char **argv)
fail("offset2 fail\n"); fail("offset2 fail\n");
return 1; return 1;
} }
ret = fcntl(fd, F_GETFD, 0);
if (ret != 0) {
fail("fd cloexec broken\n");
return 1;
}
ret = fcntl(fd2, F_GETFD, 0);
if (ret != 1) {
fail("fd2 cloexec broken\n");
return 1;
}
} else { } else {
test_waitsig(); test_waitsig();
off = lseek(fd, 0, SEEK_CUR); off = lseek(fd, 0, SEEK_CUR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment