summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-20 20:57:37 +0100
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit74d8433aa68dd73a1ea04363d4d4fd30d90c49a2 (patch)
treed792f921e6a2b76c65fc630d6182aeb576bca9fb /src/test
parent5a265e9aca07f4d8e2e6f33dc822e635b0cc36b9 (diff)
coccinelle: always use fcntl(fd, FD_DUPFD, 3) instead of dup(fd)
Let's avoid fds 0…2 for safety reasons.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-fd-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c
index 3a53f80b3..f4b73f695 100644
--- a/src/test/test-fd-util.c
+++ b/src/test/test-fd-util.c
@@ -72,9 +72,9 @@ static void test_same_fd(void) {
_cleanup_close_ int a = -1, b = -1, c = -1;
assert_se(pipe2(p, O_CLOEXEC) >= 0);
- assert_se((a = dup(p[0])) >= 0);
+ assert_se((a = fcntl(p[0], F_DUPFD, 3)) >= 0);
assert_se((b = open("/dev/null", O_RDONLY|O_CLOEXEC)) >= 0);
- assert_se((c = dup(a)) >= 0);
+ assert_se((c = fcntl(a, F_DUPFD, 3)) >= 0);
assert_se(same_fd(p[0], p[0]) > 0);
assert_se(same_fd(p[1], p[1]) > 0);