Imported Upstream version 2.3.5
[platform/upstream/git.git] / csum-file.c
index b00b215..a172199 100644 (file)
@@ -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;