summaryrefslogtreecommitdiff
path: root/udev/udevadm-info.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-01 10:22:47 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-10-01 10:22:47 +0200
commit62b9dfb62255c5b07f1356eee423aff18d6addaa (patch)
treec357a509ea6909d6dfdf62338539506660b4b68b /udev/udevadm-info.c
parent8249e04e3e9b6054768c3cd0ef72544831672b47 (diff)
libudev: device - handle /sys/block/<disk-device-link>/<partition>
Diffstat (limited to 'udev/udevadm-info.c')
-rw-r--r--udev/udevadm-info.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
index c2ff0bbea3..4da9881dbe 100644
--- a/udev/udevadm-info.c
+++ b/udev/udevadm-info.c
@@ -341,7 +341,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
break;
}
fprintf(stderr, "unknown query type\n");
- rc = 2;
+ rc = 3;
goto exit;
case 'r':
if (action == ACTION_NONE)
@@ -407,9 +407,16 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
printf("%s\n", udev_device_get_devnode(device));
} else {
size_t len;
+ const char *node;
len = strlen(udev_get_dev_path(udev));
- printf("%s\n", &udev_device_get_devnode(device)[len+1]);
+ node = udev_device_get_devnode(device);
+ if (node == NULL) {
+ fprintf(stderr, "no device node found\n");
+ rc = 5;
+ goto exit;
+ }
+ printf("%s\n", &udev_device_get_devnode(device)[len+1]);
}
break;
case QUERY_SYMLINK:
@@ -450,14 +457,14 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
case ACTION_ATTRIBUTE_WALK:
if (device == NULL) {
fprintf(stderr, "query needs a valid device specified by --path= or --name=\n");
- rc = 5;
+ rc = 4;
goto exit;
}
print_device_chain(device);
break;
case ACTION_DEVICE_ID_FILE:
if (stat_device(name, export, export_prefix) != 0)
- rc = 6;
+ rc = 1;
break;
case ACTION_ROOT:
printf("%s\n", udev_get_dev_path(udev));