X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udevinfo.c;h=5445b0fcc13e0ad1e6463a9b8439490e0afada35;hb=c7c00276f6f26ff7f38e99d887137bc1f172a978;hp=dca4616958b4eeeb5e662e034af6f58346971c91;hpb=e97717bac286ce7b13f20f95a56281807d9feeb1;p=elogind.git diff --git a/udevinfo.c b/udevinfo.c index dca461695..5445b0fcc 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #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; @@ -114,7 +129,7 @@ static int print_device_chain(const char *devpath) break; printf(" looking at parent device '%s':\n", dev->devpath); printf(" KERNELS==\"%s\"\n", dev->kernel); - printf(" SUBSYTEMS==\"%s\"\n", dev->subsystem); + printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); printf(" DRIVERS==\"%s\"\n", dev->driver); print_all_attributes(dev->devpath, "ATTRS");