aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c')
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
index 133cc6f248db..aa2f1424544a 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
@@ -20,10 +20,10 @@
*/
/*
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2015 RackTop Systems.
+ * Copyright 2016 Nexenta Systems, Inc.
*/
/*
@@ -1099,9 +1099,7 @@ zpool_open_func(void *arg)
}
/*
- * Given a file descriptor, clear (zero) the label information. This function
- * is used in the appliance stack as part of the ZFS sysevent module and
- * to implement the "zpool labelclear" command.
+ * Given a file descriptor, clear (zero) the label information.
*/
int
zpool_clear_label(int fd)
@@ -1168,7 +1166,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
*/
for (i = 0; i < dirs; i++) {
tpool_t *t;
- char *rdsk;
+ char rdsk[MAXPATHLEN];
int dfd;
boolean_t config_failed = B_FALSE;
DIR *dirp;
@@ -1184,15 +1182,17 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
*end = 0;
pathleft = &path[sizeof (path)] - end;
+#ifdef illumos
/*
* Using raw devices instead of block devices when we're
* reading the labels skips a bunch of slow operations during
* close(2) processing, so we replace /dev/dsk with /dev/rdsk.
*/
- if (strcmp(path, "/dev/dsk/") == 0)
- rdsk = "/dev/";
+ if (strcmp(path, ZFS_DISK_ROOTD) == 0)
+ (void) strlcpy(rdsk, ZFS_RDISK_ROOTD, sizeof (rdsk));
else
- rdsk = path;
+#endif
+ (void) strlcpy(rdsk, path, sizeof (rdsk));
if ((dfd = open64(rdsk, O_RDONLY)) < 0 ||
(dirp = fdopendir(dfd)) == NULL) {