summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/cmd/zoneadm/zoneadm.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c
index 10cf749e1d..800a536e2a 100644
--- a/usr/src/cmd/zoneadm/zoneadm.c
+++ b/usr/src/cmd/zoneadm/zoneadm.c
@@ -2774,7 +2774,8 @@ verify_details(int cmd_num, char *argv[])
zonecfg_fini_handle(handle);
return (Z_ERR);
}
- if (validate_zonepath(zonepath, cmd_num) != Z_OK) {
+ if (cmd_num != CMD_ATTACH &&
+ validate_zonepath(zonepath, cmd_num) != Z_OK) {
(void) fprintf(stderr, gettext("could not verify zonepath %s "
"because of the above errors.\n"), zonepath);
return_code = Z_ERR;
@@ -4795,6 +4796,16 @@ attach_func(int argc, char *argv[])
}
}
+ /* Now we can validate that the zonepath exists. */
+ if (validate_zonepath(zonepath, CMD_ATTACH) != Z_OK) {
+ (void) fprintf(stderr, gettext("could not verify zonepath %s "
+ "because of the above errors.\n"), zonepath);
+
+ assert(zonecfg_lock_file_held(&lockfd));
+ zonecfg_release_lock_file(target_zone, lockfd);
+ return (Z_ERR);
+ }
+
if ((handle = zonecfg_init_handle()) == NULL) {
zperror(cmd_to_str(CMD_ATTACH), B_TRUE);
err = Z_ERR;