Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
user/key: create new keys file on same fs as destination
Browse files Browse the repository at this point in the history
Depending on the operating system Gandalf runs on, `os.Rename()` may
fail to move this file in case its new destination lies on a different
filesystem.
  • Loading branch information
scorphus committed Oct 9, 2015
1 parent 79c823d commit bce553b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions user/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"os"
"os/user"
"path"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -107,7 +106,7 @@ func copyFile() (tsurufs.File, error) {
if statErr != nil && !os.IsNotExist(statErr) {
return nil, statErr
}
dstPath := filepath.Join(os.TempDir(), "authorized_keys")
dstPath := path + ".tmp"
dst, err := fs.Filesystem().OpenFile(dstPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return nil, err
Expand Down

0 comments on commit bce553b

Please sign in to comment.