summaryrefslogtreecommitdiff
path: root/udevinfo.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-09-05 13:54:08 +0200
committerKay Sievers <kay.sievers@suse.de>2006-09-05 13:54:08 +0200
commit492e76c9c1108a28eae356cc8bd7955ccf234980 (patch)
treee4a0c08a9a9c866be5609f72ef810ac7bed2348f /udevinfo.c
parente136a3360b9a0b746e585b9c3b2403e6dd1e7f7c (diff)
udevinfo: do not show symlinks as attributes in --attribute-walk
Diffstat (limited to 'udevinfo.c')
-rw-r--r--udevinfo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/udevinfo.c b/udevinfo.c
index e7225c8831..5445b0fcc1 100644
--- a/udevinfo.c
+++ b/udevinfo.c
@@ -26,6 +26,8 @@
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include "udev.h"
@@ -56,10 +58,23 @@ static void print_all_attributes(const char *devpath, const char *key)
dir = opendir(path);
if (dir != NULL) {
for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
+ struct stat statbuf;
+ char filename[PATH_SIZE];
char *attr_value;
char value[NAME_SIZE];
size_t len;
+ if (dent->d_name[0] == '.')
+ continue;
+
+ strlcpy(filename, path, sizeof(filename));
+ strlcat(filename, "/", sizeof(filename));
+ strlcat(filename, dent->d_name, sizeof(filename));
+ if (lstat(filename, &statbuf) != 0)
+ continue;
+ if (S_ISLNK(statbuf.st_mode))
+ continue;
+
attr_value = sysfs_attr_get_value(devpath, dent->d_name);
if (attr_value == NULL)
continue;