summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-11-09 05:31:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-11-09 05:31:26 (GMT)
commit4e9762ed4791a44f7b1c2ab66328b81bdc243173 (patch)
tree70cdfe250ef08f480f1dd266c9db952dc109fbc6 /diff.c
parent4da9f598e66fb2f2abcd3770c8253edbe0858190 (diff)
parent10e0ca843dea3e8135678600f22e0baa1edf6e44 (diff)
downloadgit-4e9762ed4791a44f7b1c2ab66328b81bdc243173.zip
git-4e9762ed4791a44f7b1c2ab66328b81bdc243173.tar.gz
git-4e9762ed4791a44f7b1c2ab66328b81bdc243173.tar.bz2
Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix'
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()
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/diff.c b/diff.c
index e6814b9..1898dd3 100644
--- a/diff.c
+++ b/diff.c
@@ -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)