summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd
diff options
context:
space:
mode:
authorBrielle Broder <bbroder@google.com>2018-06-27 13:31:46 -0700
committerShentubot <shentubot@google.com>2018-06-27 13:32:53 -0700
commitf93043615f31214193c9079d38498028331c72ca (patch)
tree3f3a3ea21114d1410f559ae7981e931ed4ba78d8 /runsc/cmd
parentc186e408cc61cbefd6d72c2ff3e9d629572570db (diff)
Added MkdirAll capabilities for Checkpoint's image-path.
Now able to save the state file (checkpoint.img) at an image-path that had previously not existed. This is important because there can only be one checkpoint.img file per directory so this will enable users to create as many directories as needed for proper organization. PiperOrigin-RevId: 202360414 Change-Id: If5dd2b72e08ab52834a2b605571186d107b64526
Diffstat (limited to 'runsc/cmd')
-rw-r--r--runsc/cmd/checkpoint.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/runsc/cmd/checkpoint.go b/runsc/cmd/checkpoint.go
index e5fc7bdc4..a28eb0f02 100644
--- a/runsc/cmd/checkpoint.go
+++ b/runsc/cmd/checkpoint.go
@@ -81,6 +81,10 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...interfa
Fatalf("image-path flag must be provided")
}
+ if err := os.MkdirAll(c.imagePath, 0755); err != nil {
+ Fatalf("error making directories at path provided: %v", err)
+ }
+
fullImagePath := filepath.Join(c.imagePath, checkpointFileName)
// Create the image file and open for writing.