Re: [PATCH] mkdir-p: Don't discard stat error

2018-12-16 Thread Niklas Hambüchen
On 15/12/2018 1:27 AM, Paul Eggert wrote: + if (stat (dir + prefix_len, ) == 0 + && S_ISDIR (st.st_mode)) That patch doesn't look quite right, since it can use errno even when stat succeeded (in which case errno contains garbage). Oops, you're right,

[PATCH] mkdir-p: Don't discard stat error

2018-12-14 Thread Niklas Hambüchen
Until now, a stat() `errno` created by `mkdir -p` after `mkdir()` is dropped silently, leading to very confusing error messages that hide the actual source of the error: `mkdir -p` can say cannot create directory ‘dir: File exists` when indeed the the file exists, is a directory (shows `d`