summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-11-03 11:41:21 +0000
committered <ed@FreeBSD.org>2009-11-03 11:41:21 +0000
commit104d85906c68c3e5f8d70ad8d9120efc045b6499 (patch)
tree7b2d90af5613ec95fd50ef52029ddddd94abd960 /sbin
parent73c660a883a03b4be59c916f55862979153ec0c7 (diff)
downloadFreeBSD-src-104d85906c68c3e5f8d70ad8d9120efc045b6499.zip
FreeBSD-src-104d85906c68c3e5f8d70ad8d9120efc045b6499.tar.gz
Just use devname(3) to print device names.
Right now sysctl just prints the major/minor numbers of a device. Instead of rolling our own routine for this, we'd better just call devname(3) to perform a translation to a device name for us.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/sysctl/sysctl.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 4810c61..38c5038 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -419,14 +419,7 @@ T_dev_t(int l2, void *p)
warnx("T_dev_T %d != %d", l2, sizeof(*d));
return (1);
}
- if ((int)(*d) != -1) {
- if (minor(*d) > 255 || minor(*d) < 0)
- printf("{ major = %d, minor = 0x%x }",
- major(*d), minor(*d));
- else
- printf("{ major = %d, minor = %d }",
- major(*d), minor(*d));
- }
+ printf("%s", devname(*d, S_IFCHR));
return (0);
}
OpenPOWER on IntegriCloud