]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: fix writeFileAtomically utility function
authorRobert Griesemer <gri@golang.org>
Thu, 24 Feb 2011 19:13:20 +0000 (11:13 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 24 Feb 2011 19:13:20 +0000 (11:13 -0800)
If the filename was absolute, writeFileAtomically
used the wrong filename for ioutil.TempFile leading
to non-existent directories and the TempFile would
fail.

R=r, r2
CC=golang-dev
https://golang.org/cl/4224043

src/cmd/godoc/utils.go

index cc028cc4d78f5b36a54d417cb8a67dd665632b03..d21e7e986344da20b2835df08f0e408f79bebba8 100644 (file)
@@ -95,7 +95,7 @@ func canonicalizePaths(list []string, filter func(path string) bool) []string {
 // atomically renames that file to the file named by filename.
 //
 func writeFileAtomically(filename string, data []byte) os.Error {
-       f, err := ioutil.TempFile(cwd, filename)
+       f, err := ioutil.TempFile(pathutil.Split(filename))
        if err != nil {
                return err
        }