cur_name_len = strlen(cur_name);
next_location += cur_name_len + 1;
- ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
+ ret = lgetxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX);
if (ret < 0) {
if (errno == ENOTSUP)
return 0;
}
static int ftw_add_entry_size(const char *fpath, const struct stat *st,
- int type)
+ int type, struct FTW *ftwbuf)
{
/*
* Failed to read the directory, mostly due to EPERM. Abort ASAP, so
fs_block_size = sectorsize;
ftw_data_size = 0;
ftw_meta_nr_inode = 0;
- ret = ftw(dir_name, ftw_add_entry_size, 10);
+
+ /*
+ * Symbolic link is not followed when creating files, so no need to
+ * follow them here.
+ */
+ ret = nftw(dir_name, ftw_add_entry_size, 10, FTW_PHYS);
if (ret < 0) {
error("ftw subdir walk of %s failed: %s", dir_name,
strerror(errno));