Merge pull request #6246 from wzshiming/fix/close-file-with-modify-perm
Close file if permission modification fails
This commit is contained in:
commit
77e76d7a52
@ -85,6 +85,7 @@ func openFile(name string, flag int, perm os.FileMode) (*os.File, error) {
|
||||
}
|
||||
// Call chmod to avoid permission mask
|
||||
if err := os.Chmod(name, perm); err != nil {
|
||||
f.Close()
|
||||
return nil, err
|
||||
}
|
||||
return f, err
|
||||
|
Loading…
Reference in New Issue
Block a user