summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjg <none@none>2007-03-02 12:27:19 -0800
committerjg <none@none>2007-03-02 12:27:19 -0800
commit25dfe2b18fb6dd87f84d482f5c5be61a8682bce3 (patch)
tree9265ebc1b720cab351adeea35ed4917b2a0f74b4
parente127a3e717f822eb855235fa3bd08235b2cf533d (diff)
downloadillumos-gate-25dfe2b18fb6dd87f84d482f5c5be61a8682bce3.tar.gz
6530211 typo in fix for libdevinfo dev_readdir
-rw-r--r--usr/src/lib/libdevinfo/devinfo_finddev.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr/src/lib/libdevinfo/devinfo_finddev.c b/usr/src/lib/libdevinfo/devinfo_finddev.c
index 28ce5e3f1b..3dfb4467c9 100644
--- a/usr/src/lib/libdevinfo/devinfo_finddev.c
+++ b/usr/src/lib/libdevinfo/devinfo_finddev.c
@@ -54,6 +54,11 @@ struct finddevhdl {
};
+#define GLOBAL_DEV_PATH(devpath) \
+ ((getzoneid() == GLOBAL_ZONEID) && \
+ ((strcmp(devpath, "/dev") == 0) || \
+ (strncmp(devpath, "/dev/", strlen("/dev/")) == 0)))
+
/*
* Return true if a device exists
* If the path refers into the /dev filesystem, use a
@@ -70,9 +75,7 @@ device_exists(const char *devname)
int rv;
struct stat st;
- if ((getzoneid() == GLOBAL_ZONEID) &&
- ((strcmp(devname, "/dev") == 0) ||
- (strncmp(devname, "/dev/", 5) == 0))) {
+ if (GLOBAL_DEV_PATH(devname)) {
rv = modctl(MODDEVEXISTS, devname, strlen(devname));
return ((rv == 0) ? 1 : 0);
}
@@ -247,9 +250,7 @@ finddev_readdir_devfs(const char *path, finddevhdl_t *handlep)
int
finddev_readdir(const char *path, finddevhdl_t *handlep)
{
- if ((getzoneid() == GLOBAL_ZONEID) &&
- ((strcmp(path, "/dev") == 0) ||
- (strncmp(path, "/dev/", 4) == 0))) {
+ if (GLOBAL_DEV_PATH(path)) {
return (finddev_readdir_devfs(path, handlep));
}
return (finddev_readdir_alt(path, handlep));