Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
t6044: add more testcases with staged changes before a merge is invoked
[gitweb.git]
/
strbuf.c
diff --git
a/strbuf.c
b/strbuf.c
index 46930ad0278db11379fe06b654e57edb128ab8a1..0759590b3e56de0fab6ff34f25206fb4cdeca4c5 100644
(file)
--- a/
strbuf.c
+++ b/
strbuf.c
@@
-620,14
+620,18
@@
ssize_t strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
{
int fd;
ssize_t len;
+ int saved_errno;
fd = open(path, O_RDONLY);
if (fd < 0)
return -1;
len = strbuf_read(sb, fd, hint);
+ saved_errno = errno;
close(fd);
- if (len < 0)
+ if (len < 0) {
+ errno = saved_errno;
return -1;
+ }
return len;
}