summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-03-28 09:33:15 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-03-28 09:33:15 -0700
commita070d621ed8e84a06ca6b710560c691dbf475b4a (patch)
tree54506d51c1820eeab58be2eaae3752e4e71815fe
parentMerge branch 'tg/test-index-v4' into maint (diff)
parentsha1fd_check: die when we cannot open the file (diff)
downloadtgif-a070d621ed8e84a06ca6b710560c691dbf475b4a.tar.xz
Merge branch 'jk/simplify-csum-file-sha1fd-check' into maint
Code simplification. * jk/simplify-csum-file-sha1fd-check: sha1fd_check: die when we cannot open the file
-rw-r--r--csum-file.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/csum-file.c b/csum-file.c
index b00b215031..a172199e44 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -130,14 +130,10 @@ struct sha1file *sha1fd_check(const char *name)
sink = open("/dev/null", O_WRONLY);
if (sink < 0)
- return NULL;
+ die_errno("unable to open /dev/null");
check = open(name, O_RDONLY);
- if (check < 0) {
- int saved_errno = errno;
- close(sink);
- errno = saved_errno;
- return NULL;
- }
+ if (check < 0)
+ die_errno("unable to open '%s'", name);
f = sha1fd(sink, name);
f->check_fd = check;
return f;