diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:58:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 08:20:19 +0200 |
commit | 7f6e12b03300ba3e473ce6b85d823fc0375b335e (patch) | |
tree | c60a5f1afa25a4f5a4fde12ce49047054c489a34 /coccinelle | |
parent | tree-wide: make more code use safe_close() (diff) | |
download | systemd-7f6e12b03300ba3e473ce6b85d823fc0375b335e.tar.gz systemd-7f6e12b03300ba3e473ce6b85d823fc0375b335e.tar.bz2 systemd-7f6e12b03300ba3e473ce6b85d823fc0375b335e.zip |
tree-wide: drop redundant if checks before safe_close()
Replace this:
if (fd >= 0)
safe_close(fd);
by this:
safe_close(fd);
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/safe_close-no-if.cocci | 7 |
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 000000000..81c567851 --- /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); |