diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-09-08 13:30:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-08 13:30:32 -0700 |
commit | 7b062226196c7234818106ab5274b32519e41575 (patch) | |
tree | af74b94d18186099a4a7929968a7691138058735 /contrib | |
parent | c8f491668e46d66290aec97caaf94fe2c1ecccbd (diff) | |
parent | 66e905b7dd0f4e9dd576be681f30fbaeeb19ec4a (diff) | |
download | git-7b062226196c7234818106ab5274b32519e41575.tar.gz |
Merge branch 'rs/xopen-reports-open-failures'
Error diagnostics improvement.
* rs/xopen-reports-open-failures:
use xopen() to handle fatal open(2) failures
xopen: explicitly report creation failures
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/coccinelle/xopen.cocci | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/coccinelle/xopen.cocci b/contrib/coccinelle/xopen.cocci new file mode 100644 index 0000000000..814d7b8a1a --- /dev/null +++ b/contrib/coccinelle/xopen.cocci @@ -0,0 +1,16 @@ +@@ +identifier fd; +identifier die_fn =~ "^(die|die_errno)$"; +@@ +( + fd = +- open ++ xopen + (...); +| + int fd = +- open ++ xopen + (...); +) +- if ( \( fd < 0 \| fd == -1 \) ) { die_fn(...); } |