From e6c1a2bde7609cc703a5fad34c3bc1d15d19bbdc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 18:58:52 +0200 Subject: use openat(), unlinkat(), fstatat() --- udev/udevadm-info.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'udev/udevadm-info.c') 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 #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; -- cgit v1.2.3-54-g00ecf