From 948bb29d27dc7e367cd27003c059d83301b15c4f Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Sat, 9 Nov 2013 00:53:58 +0000 Subject: [PATCH] Don't use drivers to store temporary image downloads --- graph.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/graph.go b/graph.go index 54618ead5a..e42c4ecbf6 100644 --- a/graph.go +++ b/graph.go @@ -185,18 +185,9 @@ func (graph *Graph) TempLayerArchive(id string, compression archive.Compression, // Mktemp creates a temporary sub-directory inside the graph's filesystem. func (graph *Graph) Mktemp(id string) (string, error) { - if id == "" { - id = GenerateID() - } - // FIXME: use a separate "tmp" driver instead of the regular driver, - // to allow for removal at cleanup. - // Right now temp directories are never removed! - if err := graph.driver.Create(id, ""); err != nil { - return "", fmt.Errorf("Driver %s couldn't create temporary directory %s: %s", graph.driver, id, err) - } - dir, err := graph.driver.Get(id) - if err != nil { - return "", fmt.Errorf("Driver %s couldn't get temporary directory %s: %s", graph.driver, id, err) + dir := path.Join(graph.Root, "_tmp", GenerateID()) + if err := os.MkdirAll(dir, 0700); err != nil { + return "", err } return dir, nil }