diff options
Diffstat (limited to 'udev/udevadm-info.c')
-rw-r--r-- | udev/udevadm-info.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index db11a289b2..b743a1d642 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -25,6 +25,7 @@ #include <dirent.h> #include <errno.h> #include <getopt.h> +#include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> @@ -40,7 +41,6 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { struct stat statbuf; - char filename[UTIL_PATH_SIZE]; const char *value; size_t len; @@ -52,8 +52,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (strcmp(dent->d_name, "dev") == 0) continue; - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(device), "/", dent->d_name, NULL); - if (lstat(filename, &statbuf) != 0) + if (fstatat(dirfd(dir), dent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW) != 0) continue; if (S_ISLNK(statbuf.st_mode)) continue; |