Closed illwieckz closed 4 months ago
One may open the folder with open
then use fstatat
on the file name to avoid concatenating a string, but we better assume doing an extra IO is slower than string concatenation.
Also an alternate code to use open
on the parent dir to then use fdopendir
instead of opendir
to then reuse the fd with fstatat
is not possible as the man page says:
After a successful call to fdopendir(), fd is used internally by the implemen‐ tation, and should not otherwise be used by the application.
So this may be the fastest code.
The alternate code was testing for the file name in the current directory.
Fixes #63: