diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-04-04 11:02:11 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-04-12 11:44:56 +0200 |
commit | 41f6e627d7cfdf1ea50d5adbd7e118589dbcf8db (patch) | |
tree | 979f9a42211a4abbad46950b6e069d3f109f68de /coccinelle | |
parent | Add fopen_unlocked() wrapper (diff) | |
download | systemd-41f6e627d7cfdf1ea50d5adbd7e118589dbcf8db.tar.xz systemd-41f6e627d7cfdf1ea50d5adbd7e118589dbcf8db.zip |
Make fopen_temporary and fopen_temporary_label unlocked
This is partially a refactoring, but also makes many more places use
unlocked operations implicitly, i.e. all users of fopen_temporary().
AFAICT, the uses are always for short-lived files which are not shared
externally, and are just used within the same context. Locking is not
necessary.
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/fopen-unlocked.cocci | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/coccinelle/fopen-unlocked.cocci b/coccinelle/fopen-unlocked.cocci index 93b993dd55..e6f2bc5681 100644 --- a/coccinelle/fopen-unlocked.cocci +++ b/coccinelle/fopen-unlocked.cocci @@ -35,3 +35,17 @@ expression f, path, options; + return -ESRCH; + if (r < 0) + return r; +@@ +expression f, path, p; +@@ + r = fopen_temporary(path, &f, &p); + if (r < 0) + return ...; +- (void) __fsetlocking(f, FSETLOCKING_BYCALLER); +@@ +expression f, g, path, p; +@@ + r = fopen_temporary_label(path, g, &f, &p); + if (r < 0) + return ...; +- (void) __fsetlocking(f, FSETLOCKING_BYCALLER); |