Thread (1 message) 1 message, 1 author, 2017-10-27

Re: [PATCH] diff: fix lstat() error handling in diff_populate_filespec()

From: Junio C Hamano <hidden>
Date: 2017-10-27 16:36:02

Andrey Okoshkin [off-list ref] writes:
I'm not sure why only ENOENT error of lstat() is considered as an
error but passing by other errno values leads to reading of
uninitialized 'struct stat st' variable.  It means that the
populated 'diff_filespec' structure may be incorrectly filled.
Entirely correct.  There is no fundamental reason to try special
casing ENOENT, unless we are clearing the "this is an error" bit
when the errno is ENOENT---but this code does not even do so.  All
errors are errors---we wanted to know the result of lstat() to carry
on, and we couldn't figure out the status.  We do not want to die
immediately (instead we want to show diffs for other paths), so
substituting the result with an empty string is the least bad thing
we can do at this point in the code.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help