From: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> This will allow the function to be used in a later patch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- strbuf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/strbuf.c b/strbuf.c index 0346e74..f1fec58 100644 --- a/strbuf.c +++ b/strbuf.c @@ -482,15 +482,18 @@ int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term) int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint) { - int fd, len; + int fd, len, 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; } -- 2.1.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html