chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5a265e9
)
coccinelle: always use fcntl(fd, FD_DUPFD, 3) instead of dup(fd)
author
Lennart Poettering
<lennart@poettering.net>
Tue, 20 Mar 2018 19:57:37 +0000
(20:57 +0100)
committer
Sven Eden
<yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000
(16:47 +0200)
Let's avoid fds 0…2 for safety reasons.
src/test/test-fd-util.c
patch
|
blob
|
history
diff --git
a/src/test/test-fd-util.c
b/src/test/test-fd-util.c
index 3a53f80b32e5a2f595f15b4fcabb4526ff7200e0..f4b73f6956b30b661f3d91aa838bac8e82ded6b1 100644
(file)
--- 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);