提交 eae59c1b 编写于 作者: J Junio C Hamano

Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix' into maint

After an error from lstat(), diff_populate_filespec() function
sometimes still went ahead and used invalid data in struct stat,
which has been fixed.

* ao/diff-populate-filespec-lstat-errorpath-fix:
  diff: fix lstat() error handling in diff_populate_filespec()
......@@ -3545,14 +3545,12 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)
int fd;
if (lstat(s->path, &st) < 0) {
if (errno == ENOENT) {
err_empty:
err = -1;
empty:
s->data = (char *)"";
s->size = 0;
return err;
}
err_empty:
err = -1;
empty:
s->data = (char *)"";
s->size = 0;
return err;
}
s->size = xsize_t(st.st_size);
if (!s->size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册