summaryrefslogtreecommitdiff
path: root/coccinelle
diff options
context:
space:
mode:
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/fopen-unlocked.cocci12
1 files changed, 12 insertions, 0 deletions
diff --git a/coccinelle/fopen-unlocked.cocci b/coccinelle/fopen-unlocked.cocci
index e6f2bc5681..bbd70a6338 100644
--- a/coccinelle/fopen-unlocked.cocci
+++ b/coccinelle/fopen-unlocked.cocci
@@ -49,3 +49,15 @@ expression f, g, path, p;
if (r < 0)
return ...;
- (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
+@@
+expression f, fd, options;
+@@
+- f = fdopen(fd, options);
++ r = fdopen_unlocked(fd, options, &f);
++ if (r < 0) {
+- if (!f) {
+ ...
+- return -errno;
++ return r;
+ }
+- (void) __fsetlocking(f, FSETLOCKING_BYCALLER);