]> err.no Git - systemd/commitdiff
udevadm: info - fix --query=all for devices without a device node
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 3 Oct 2008 08:33:15 +0000 (10:33 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 3 Oct 2008 08:33:15 +0000 (10:33 +0200)
udev/lib/test-libudev.c
udev/udevadm-info.c

index 47fbf3b42ab0630cee6f9d4c107d01307df28c76..854a0a9faac30d2693022a9b7781f2a2f4bb6d75 100644 (file)
@@ -104,7 +104,7 @@ static int test_device(struct udev *udev, const char *syspath)
        printf("looking at device: %s\n", syspath);
        device = udev_device_new_from_syspath(udev, syspath);
        if (device == NULL) {
-               printf("no device\n");
+               printf("no device found\n");
                return -1;
        }
        print_device(device);
index ec098abd187a102d3f0874dd23e96484b2fb9fb4..b18f249495587498bd56095a7d5f06507c97dda7 100644 (file)
@@ -130,13 +130,16 @@ static int print_device_chain(struct udev_device *device)
 static void print_record(struct udev_device *device)
 {
        size_t len;
+       const char *str;
        int i;
        struct udev_list_entry *list_entry;
 
        printf("P: %s\n", udev_device_get_devpath(device));
 
        len = strlen(udev_get_dev_path(udev_device_get_udev(device)));
-       printf("N: %s\n", &udev_device_get_devnode(device)[len+1]);
+       str = udev_device_get_devnode(device);
+       if (str != NULL)
+               printf("N: %s\n", &str[len+1]);
 
        i = device_get_devlink_priority(device);
        if (i != 0)
@@ -159,7 +162,6 @@ static void print_record(struct udev_device *device)
                printf("E: %s=%s\n",
                       udev_list_entry_get_name(list_entry),
                       udev_list_entry_get_value(list_entry));
-
        printf("\n");
 }