aboutsummaryrefslogtreecommitdiff
path: root/csum-file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-28 09:33:15 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-28 09:33:15 -0700
commita070d621ed8e84a06ca6b710560c691dbf475b4a (patch)
tree54506d51c1820eeab58be2eaae3752e4e71815fe /csum-file.c
parentb265061937b2b0077a37b44a463fe60e1d55156c (diff)
parent599d2231077bac5950a9e535c001d557719ff213 (diff)
downloadgit-a070d621ed8e84a06ca6b710560c691dbf475b4a.tar.gz
git-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
Diffstat (limited to 'csum-file.c')
-rw-r--r--csum-file.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/csum-file.c b/csum-file.c
index b00b21503..a172199e4 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;