fs: new files and folders created honors umask (#2023)

umask should be honored properly for all write
operations on filesystem. This is in line with
how all unix tools behave.

Fixes #2022
This commit is contained in:
Harshavardhana
2017-02-19 22:41:56 +01:00
committed by Anis Elleuch
parent 1f48b16acb
commit d055f0edac
+4 -4
View File
@@ -222,14 +222,14 @@ func (f *fsClient) put(reader io.Reader, size int64, metadata map[string][]strin
objectPartPath := objectPath + partSuffix
if objectDir != "" {
// Create any missing top level directories.
if e = os.MkdirAll(objectDir, 0700); e != nil {
if e = os.MkdirAll(objectDir, 0777); e != nil {
err := f.toClientError(e, f.PathURL.Path)
return 0, err.Trace(f.PathURL.Path)
}
}
// If exists, open in append mode. If not create it the part file.
partFile, e := os.OpenFile(objectPartPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
partFile, e := os.OpenFile(objectPartPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
if e != nil {
err := f.toClientError(e, f.PathURL.Path)
return 0, err.Trace(f.PathURL.Path)
@@ -403,7 +403,7 @@ func createFile(fpath string) (io.WriteCloser, error) {
if e != nil && !os.IsNotExist(e) {
return nil, e
}
if e = os.MkdirAll(filepath.Dir(fpath), 0775); e != nil {
if e = os.MkdirAll(filepath.Dir(fpath), 0777); e != nil {
return nil, e
}
file, e := os.Create(fpath)
@@ -1097,7 +1097,7 @@ func (f *fsClient) listRecursiveInRoutine(contentCh chan *clientContent, incompl
// MakeBucket - create a new bucket.
func (f *fsClient) MakeBucket(region string) *probe.Error {
e := os.MkdirAll(f.PathURL.Path, 0775)
e := os.MkdirAll(f.PathURL.Path, 0777)
if e != nil {
return probe.NewError(e)
}