diff options
author | Alexander Eremin <a.eremin@nexenta.com> | 2016-05-24 23:49:54 -0700 |
---|---|---|
committer | Dan McDonald <danmcd@omniti.com> | 2016-06-20 15:45:13 -0400 |
commit | b13c8383ad6f847486face2fe8df9f0f50f068ed (patch) | |
tree | 0b34e9b130e54f149f962f851ecb1b4b7ca3818c /usr/src | |
parent | e64b5a1d424c9f5d94989cfbd14203251c97a024 (diff) | |
download | illumos-joyent-b13c8383ad6f847486face2fe8df9f0f50f068ed.tar.gz |
6992 devprop(1M) should work also with logical names
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/devprop/devprop.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr/src/cmd/devprop/devprop.c b/usr/src/cmd/devprop/devprop.c index 69306353a7..80bf0f4960 100644 --- a/usr/src/cmd/devprop/devprop.c +++ b/usr/src/cmd/devprop/devprop.c @@ -21,9 +21,9 @@ /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> #include <unistd.h> @@ -50,7 +50,7 @@ main(int argc, char *argv[]) uchar_t *val_b; int *val_i; int64_t *val_l; - char *val_s; + char *val_s, *ptr; int n; extern char *optarg; @@ -73,7 +73,8 @@ case ch: \ while ((c = getopt(argc, argv, ":n:vqbils")) != -1) { switch (c) { case 'n': - path = optarg; + if ((path = realpath(optarg, NULL)) == NULL) + path = optarg; break; case ':': usage(); @@ -108,9 +109,14 @@ case ch: \ * "/devices", which we strip off here as di_init() expects * just the path to the node. */ - if (strncmp("/devices/", path, strlen("/devices/")) == 0) + if (strncmp("/devices/", path, strlen("/devices/")) == 0) { path += strlen("/devices"); + /* cut off minor name */ + if ((ptr = strrchr(path, ':')) != NULL) + *ptr = '\0'; + } + if ((dn = di_init(path, DINFOPROP)) == DI_NODE_NIL) { perror("di_init"); return (1); |