summaryrefslogtreecommitdiffstats
path: root/coccinelle/errno-check.cocci
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2020-10-07 15:26:16 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2020-10-09 14:48:44 +0200
commit7e97526421b0a1180fb16fbfcf8a758e48d529e6 (patch)
treee629609861167728733eb4b9194223227bee7df9 /coccinelle/errno-check.cocci
parentcoccinelle: correctly resolve our own macros (diff)
downloadsystemd-7e97526421b0a1180fb16fbfcf8a758e48d529e6.tar.xz
systemd-7e97526421b0a1180fb16fbfcf8a758e48d529e6.zip
coccinelle: check for invalid errno comparisons
Prompted by #15868
Diffstat (limited to 'coccinelle/errno-check.cocci')
-rw-r--r--coccinelle/errno-check.cocci10
1 files changed, 10 insertions, 0 deletions
diff --git a/coccinelle/errno-check.cocci b/coccinelle/errno-check.cocci
new file mode 100644
index 0000000000..709cb4ace6
--- /dev/null
+++ b/coccinelle/errno-check.cocci
@@ -0,0 +1,10 @@
+@@
+constant c;
+@@
+(
+- errno == -c
++ errno == c
+|
+- errno != -c
++ errno != c
+)