Skip to content

Commit

Permalink
Merge pull request syncthing#2525 from kluppy/master
Browse files Browse the repository at this point in the history
Don't chmod in Atomic on android (fixes  syncthing#2472)
  • Loading branch information
calmh committed Nov 28, 2015
2 parents f0c8b7c + f062e35 commit 1ebc9a9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/osutil/atomic.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ func CreateAtomic(path string, mode os.FileMode) (*AtomicWriter, error) {
return nil, err
}

if err := os.Chmod(fd.Name(), mode); err != nil {
fd.Close()
os.Remove(fd.Name())
return nil, err
// chmod fails on Android so don't even try
if runtime.GOOS != "android" {
if err := os.Chmod(fd.Name(), mode); err != nil {
fd.Close()
os.Remove(fd.Name())
return nil, err
}
}

w := &AtomicWriter{
Expand Down

0 comments on commit 1ebc9a9

Please sign in to comment.