]> git.ipfire.org Git - thirdparty/systemd.git/blame - coccinelle/take-fd.cocci
nspawn: rework how /run/host/ is set up
[thirdparty/systemd.git] / coccinelle / take-fd.cocci
CommitLineData
c10d6bdb
LP
1@@
2local idexpression p;
3expression q;
4@@
5- p = q;
6- q = -1;
7- return p;
8+ return TAKE_FD(q);
17e3e37c
FS
9
10/* The ideal solution would use 'local idexpression' to avoid matching errno,
11 * which is a global variable. However, 'idexpression' nor 'identifier'
12 * would match, for example, "x->fd", which is considered 'expression' in
13 * the SmPL grammar
14 */
c10d6bdb 15@@
17e3e37c
FS
16expression p != errno;
17expression q;
c10d6bdb
LP
18@@
19- p = q;
20- q = -1;
21+ p = TAKE_FD(q);