diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-08 18:53:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 08:20:19 +0200 |
commit | 66e405837bf250f50472c886f9c7452634ca3776 (patch) | |
tree | 3692d7ab79969d49ec031c2a5742520cfb500f5f /coccinelle/safe_close.cocci | |
parent | a1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b (diff) | |
download | systemd-66e405837bf250f50472c886f9c7452634ca3776.tar.gz |
tree-wide: make more code use safe_close()
Replace this:
close(fd);
fd = -1;
write this:
fd = safe_close(fd);
Diffstat (limited to 'coccinelle/safe_close.cocci')
-rw-r--r-- | coccinelle/safe_close.cocci | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/coccinelle/safe_close.cocci b/coccinelle/safe_close.cocci new file mode 100644 index 0000000000..6fedd804f2 --- /dev/null +++ b/coccinelle/safe_close.cocci @@ -0,0 +1,18 @@ +@@ +expression fd; +@@ +- close(fd); +- fd = -1; ++ fd = safe_close(fd); +@@ +expression fd; +@@ +- close_nointr(fd); +- fd = -1; ++ fd = safe_close(fd); +@@ +expression fd; +@@ +- safe_close(fd); +- fd = -1; ++ fd = safe_close(fd); |