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);
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)
printf("E: %s=%s\n",
udev_list_entry_get_name(list_entry),
udev_list_entry_get_value(list_entry));
-
printf("\n");
}