On Sat Nov 1, 2025 at 11:04 AM CET, Michael Tokarev wrote: > On 10/30/25 16:12, Kostiantyn Kostiuk wrote:
>> From: Rodrigo Dias Correa <[email protected]> >> >> +static bool file_exists(const char *path) >> +{ >> + struct stat st; >> + return stat(path, &st) == 0 && (S_ISREG(st.st_mode) || >> S_ISLNK(st.st_mode)); >> +} > > stat(2) will never return info about a symlink, so S_ISLINK here is > always 0. It is lstat(2) wihch might return symlink info. > You are right, I overlooked this in stat(2) documentation. > > Not that this is a bug, just a confusing expression which will be > copy-pasted by other new users and the confusion will spread ;) > > I think I'll send a fix for this, since this patch is landed in > master. I appreciate that. Thanks, Rodrigo > > Thanks, > > /mjt
