When calling 'stat -c %N' to print the filename, don't explicitly
request the size of the file via statx(), as it may add overhead on
some filesystems. The size is only needed to optimize an allocation
for the relatively rare case of reading a symlink name, and the worst
effect is a somewhat-too-large temporary buffer may be allocated for
areadlink_with_size(), or internal retries if buffer is too small.
The file size will be returned by statx() on most filesystems, even
if not requested, unless the filesystem considers this to be too
expensive for that file, in which case the tradeoff is worthwhile.
* src/stat.c: Don't explicitly request STATX_SIZE for filenames.
switch (fmt)
{
case 'N':
- return STATX_MODE|STATX_SIZE;
+ return STATX_MODE;
case 'd':
case 'D':
return STATX_MODE;
int fd = STREQ (filename, "-") ? 0 : AT_FDCWD;
int flags = 0;
struct stat st;
- struct statx stx;
+ struct statx stx = { 0, };
const char *pathname = filename;
struct print_args pa;
pa.st = &st;