summaryrefslogtreecommitdiff
path: root/usr/src/cmd/zinject
diff options
context:
space:
mode:
authorChris Kirby <Chris.Kirby@sun.com>2010-04-08 11:02:22 -0600
committerChris Kirby <Chris.Kirby@sun.com>2010-04-08 11:02:22 -0600
commitf80ce222af313ec87dc070b2219b29c81c5e5d8c (patch)
tree90fb6de5db7dbe13192fc627fbfbeef86f869c6f /usr/src/cmd/zinject
parent4e567b4443d7a1680a7319275e5288eef2c92319 (diff)
downloadillumos-joyent-f80ce222af313ec87dc070b2219b29c81c5e5d8c.tar.gz
6891449 zvol_strategy() check for zv == NULL too late
6911444 rebooting off snapshot: assertion failed: vfsp->vfs_count != 0 (common/fs/vfs.c) 6649967 multiple '/' exist in path will confuse zinject 6935668 zvol_minor_lookup() can return wrong zvol
Diffstat (limited to 'usr/src/cmd/zinject')
-rw-r--r--usr/src/cmd/zinject/translate.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/usr/src/cmd/zinject/translate.c b/usr/src/cmd/zinject/translate.c
index b6ea53c3ee..219ee76bd9 100644
--- a/usr/src/cmd/zinject/translate.c
+++ b/usr/src/cmd/zinject/translate.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <libzfs.h>
@@ -67,6 +66,18 @@ ziprintf(const char *fmt, ...)
va_end(ap);
}
+static void
+compress_slashes(const char *src, char *dest)
+{
+ while (*src != '\0') {
+ *dest = *src++;
+ while (*dest == '/' && *src == '/')
+ ++src;
+ ++dest;
+ }
+ *dest = '\0';
+}
+
/*
* Given a full path to a file, translate into a dataset name and a relative
* path within the dataset. 'dataset' must be at least MAXNAMELEN characters,
@@ -74,13 +85,16 @@ ziprintf(const char *fmt, ...)
* buffer, which we need later to get the object ID.
*/
static int
-parse_pathname(const char *fullpath, char *dataset, char *relpath,
+parse_pathname(const char *inpath, char *dataset, char *relpath,
struct stat64 *statbuf)
{
struct extmnttab mp;
FILE *fp;
int match;
const char *rel;
+ char fullpath[MAXPATHLEN];
+
+ compress_slashes(inpath, fullpath);
if (fullpath[0] != '/') {
(void) fprintf(stderr, "invalid object '%s': must be full "