summaryrefslogtreecommitdiff
path: root/coccinelle/safe_close-no-if.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle/safe_close-no-if.cocci')
-rw-r--r--coccinelle/safe_close-no-if.cocci7
1 files changed, 7 insertions, 0 deletions
diff --git a/coccinelle/safe_close-no-if.cocci b/coccinelle/safe_close-no-if.cocci
new file mode 100644
index 0000000000..81c5678518
--- /dev/null
+++ b/coccinelle/safe_close-no-if.cocci
@@ -0,0 +1,7 @@
+@@
+expression fd;
+@@
+- if (fd >= 0) {
+- fd = safe_close(fd);
+- }
++ fd = safe_close(fd);