azure: another cross-fs tempfile moving fix

Actually fixes #3313.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
Ahmet Alp Balkan 2016-07-08 10:02:46 -07:00
parent eeb35dd5e4
commit af44041f28
No known key found for this signature in database
GPG Key ID: FE66C91D08961ED4
1 changed files with 2 additions and 2 deletions

View File

@ -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)
}
@ -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)