]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - coccinelle/take-fd.cocci
coccinelle: exclude JsonVariant* from the IN_SET transformation
[thirdparty/systemd.git] / coccinelle / take-fd.cocci
index ba242483cd50c7d9f30081fb46fb85af02187303..f7124e789651cfe6db9571c63527cf11839bb8d7 100644 (file)
@@ -6,8 +6,15 @@ expression q;
 - q = -1;
 - return p;
 + return TAKE_FD(q);
+
+/* The ideal solution would use 'local idexpression' to avoid matching errno,
+ * which is a global variable. However, 'idexpression' nor 'identifier'
+ * would match, for example, "x->fd", which is considered 'expression' in
+ * the SmPL grammar
+ */
 @@
-expression p, q;
+expression p != errno;
+expression q;
 @@
 - p = q;
 - q = -1;