summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-25 12:54:19 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-25 12:54:19 -0700
commit09e32fa0f886c5ce5ded5e213f690ed32017f369 (patch)
treef532895a03ee23154887a84cf84eb5715009e0b1
parent5f15cba2f95f5678fc69bd305dbbb778e1fad579 (diff)
parent599d2231077bac5950a9e535c001d557719ff213 (diff)
downloadgit-09e32fa0f886c5ce5ded5e213f690ed32017f369.tar.gz
Merge branch 'jk/simplify-csum-file-sha1fd-check'
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;