socsvn commit: r329245 - soc2017/kneitinger/libbe-head/sbin/be

allanjude at FreeBSD.org allanjude at FreeBSD.org
Thu Nov 9 16:40:14 UTC 2017


Author: allanjude
Date: Thu Nov  9 16:40:13 2017
New Revision: 329245
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=329245

Log:
  Fix the 'be create newbe at newsnap' case
  
  The snapshot name passed to be_create_from_existing_snap() must be canonical

Modified:
  soc2017/kneitinger/libbe-head/sbin/be/be.c

Modified: soc2017/kneitinger/libbe-head/sbin/be/be.c
==============================================================================
--- soc2017/kneitinger/libbe-head/sbin/be/be.c	Thu Nov  9 16:39:17 2017	(r329244)
+++ soc2017/kneitinger/libbe-head/sbin/be/be.c	Thu Nov  9 16:40:13 2017	(r329245)
@@ -176,6 +176,7 @@
 	int err, opt;
 	char *snapname;
 	char *bootenv;
+	char *source;
 
 	snapname = NULL;
 	while ((opt = getopt(argc, argv, "e:")) != -1) {
@@ -211,12 +212,13 @@
 	} else {
 		if ((snapname = strchr(bootenv, '@')) != NULL) {
 			*(snapname++) = '\0';
-			if ((err = be_snapshot(be, bootenv, snapname, true, NULL))
-			    != BE_ERR_SUCCESS) {
+			if ((err = be_snapshot(be, (char *)be_active_path(be),
+			    snapname, true, NULL)) != BE_ERR_SUCCESS) {
 				fprintf(stderr, "failed to create snapshot\n");
 			}
+			asprintf(&source, "%s@%s", be_active_path(be), snapname);
 			err = be_create_from_existing_snap(be, bootenv,
-			    snapname);
+			    source);
 			return (err);
 		} else {
 			err = be_create(be, bootenv);


More information about the svn-soc-all mailing list