Skip to content

Commit

Permalink
Merge pull request docker#3575 from ahmetalpbalkan/azure-atomic-write
Browse files Browse the repository at this point in the history
azure: another cross-fs tempfile moving fix
  • Loading branch information
nathanleclaire authored Jul 8, 2016
2 parents eeb35dd + af44041 commit 770d198
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/azure/azureutil/tenantid.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func saveTenantID(path string, tenantID string) error {
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 {
return fmt.Errorf("Failed to create temp file: %v", err)
}
Expand All @@ -107,7 +107,7 @@ func saveTenantID(path string, tenantID string) error {

// atomic move by rename
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 {
return fmt.Errorf("Failed to chmod the file %s: %v", path, err)
Expand Down

0 comments on commit 770d198

Please sign in to comment.