Replace this:
close(fd);
fd = -1;
write this:
fd = safe_close(fd);
--- /dev/null
+@@
+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);
assert(b);
if (b->fd >= 0) {
- close(b->fd);
- b->fd = -1;
+ b->fd = safe_close(b->fd);
}
p = strjoina("/dev/input/", b->name);
return 0;
fail:
- close(b->fd);
- b->fd = -1;
+ b->fd = safe_close(b->fd);
return r;
}