summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-20 20:57:37 +0100
committerLennart Poettering <lennart@poettering.net>2018-03-20 22:31:14 +0100
commit43dc7aa2ba9e2e943b7bde47ce707fd1c0b778b1 (patch)
tree1c07bcabde02048d181c5b63d6ba0e136dcf248e /coccinelle
parentbe6b0c21654e1c587cb942d464281bcc89ef4ddf (diff)
downloadsystemd-43dc7aa2ba9e2e943b7bde47ce707fd1c0b778b1.tar.gz
coccinelle: always use fcntl(fd, FD_DUPFD, 3) instead of dup(fd)
Let's avoid fds 0…2 for safety reasons.
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/dup-fcntl.cocci5
1 files changed, 5 insertions, 0 deletions
diff --git a/coccinelle/dup-fcntl.cocci b/coccinelle/dup-fcntl.cocci
new file mode 100644
index 0000000000..ef13564282
--- /dev/null
+++ b/coccinelle/dup-fcntl.cocci
@@ -0,0 +1,5 @@
+@@
+expression fd;
+@@
+- dup(fd)
++ fcntl(fd, F_DUPFD, 3)