aboutsummaryrefslogtreecommitdiff
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
parentcoccinelle: make use of DIV_ROUND_UP() wherever appropriate (diff)
downloadsystemd-43dc7aa2ba9e2e943b7bde47ce707fd1c0b778b1.tar.gz
systemd-43dc7aa2ba9e2e943b7bde47ce707fd1c0b778b1.tar.bz2
systemd-43dc7aa2ba9e2e943b7bde47ce707fd1c0b778b1.zip
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 000000000..ef1356428
--- /dev/null
+++ b/coccinelle/dup-fcntl.cocci
@@ -0,0 +1,5 @@
+@@
+expression fd;
+@@
+- dup(fd)
++ fcntl(fd, F_DUPFD, 3)