From 66e405837bf250f50472c886f9c7452634ca3776 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 8 Sep 2015 18:53:19 +0200 Subject: tree-wide: make more code use safe_close() Replace this: close(fd); fd = -1; write this: fd = safe_close(fd); --- coccinelle/safe_close.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 coccinelle/safe_close.cocci (limited to 'coccinelle') 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); -- cgit v1.2.3-54-g00ecf