mirror of https://github.com/docker/docs.git
azure: another cross-fs tempfile moving fix
Actually fixes #3313. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
parent
eeb35dd5e4
commit
af44041f28
|
|
@ -93,7 +93,7 @@ func saveTenantID(path string, tenantID string) error {
|
||||||
return fmt.Errorf("Failed to create directory %s: %v", dir, err)
|
return fmt.Errorf("Failed to create directory %s: %v", dir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := ioutil.TempFile(os.TempDir(), "tenantid")
|
f, err := ioutil.TempFile(dir, "tenantid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failed to create temp file: %v", err)
|
return fmt.Errorf("Failed to create temp file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +107,7 @@ func saveTenantID(path string, tenantID string) error {
|
||||||
|
|
||||||
// atomic move by rename
|
// atomic move by rename
|
||||||
if err := os.Rename(fp, path); err != nil {
|
if err := os.Rename(fp, path); err != nil {
|
||||||
return fmt.Errorf("Failed to rename file: %v", err)
|
return fmt.Errorf("Failed to rename file. src=%s dst=%s error=%v", fp, path, err)
|
||||||
}
|
}
|
||||||
if err := os.Chmod(path, perm); err != nil {
|
if err := os.Chmod(path, perm); err != nil {
|
||||||
return fmt.Errorf("Failed to chmod the file %s: %v", path, err)
|
return fmt.Errorf("Failed to chmod the file %s: %v", path, err)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue