From 02e23d1a1a8c3baf73d82da5abbab3a4eeb1cbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 4 Apr 2019 11:27:08 +0200 Subject: Add fdopen_unlocked() wrapper --- coccinelle/fopen-unlocked.cocci | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'coccinelle') 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); -- cgit v1.2.1