From e7002e097b242b3cc0c15a09054a56e56ebb2f1f Mon Sep 17 00:00:00 2001 From: Krishna Srinivas Date: Wed, 18 Nov 2015 00:48:44 -0800 Subject: [PATCH] during Put() fs returns client.PathInsufficientPermission{} for EPERM - fixes #1410 --- pkg/client/fs/fs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/client/fs/fs.go b/pkg/client/fs/fs.go index 95677fb5..492921ed 100644 --- a/pkg/client/fs/fs.go +++ b/pkg/client/fs/fs.go @@ -122,11 +122,17 @@ func (f *fsClient) Put(size int64, data io.Reader) *probe.Error { objectPath := f.PathURL.Path if objectDir != "" { if err := os.MkdirAll(objectDir, 0700); err != nil { + if os.IsPermission(err) { + return probe.NewError(client.PathInsufficientPermission{Path: f.PathURL.Path}) + } return probe.NewError(err) } } fs, err := os.Create(objectPath) if err != nil { + if os.IsPermission(err) { + return probe.NewError(client.PathInsufficientPermission{Path: f.PathURL.Path}) + } return probe.NewError(err) } defer fs.Close()