X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev%2Fudevadm-info.c;h=b743a1d642faa0f741e982c00c5a95b5ba3c24ef;hp=db11a289b249574ccd169a071cecc743e27c66e3;hb=e6c1a2bde7609cc703a5fad34c3bc1d15d19bbdc;hpb=eba87f55f6383cd61a11fce2ae37ac8100d6ded2 diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index db11a289b..b743a1d64 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -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;