Skip to content

Commit

Permalink
UPSTREAM: <carry>: only chown if non-windows machine
Browse files Browse the repository at this point in the history
  • Loading branch information
rphillips authored and openshift-cherrypick-robot committed Jun 23, 2021
1 parent 87cc9a4 commit cd34728
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/volume/util/atomic_writer.go
Expand Up @@ -373,6 +373,7 @@ func (w *AtomicWriter) newTimestampDir() (string, error) {
// writePayloadToDir writes the given payload to the given directory. The
// directory must exist.
func (w *AtomicWriter) writePayloadToDir(payload map[string]FileProjection, dir string) error {
isNotWindows := runtime.GOOS != "windows"
for userVisiblePath, fileProjection := range payload {
content := fileProjection.Data
mode := os.FileMode(fileProjection.Mode)
Expand Down Expand Up @@ -400,9 +401,11 @@ func (w *AtomicWriter) writePayloadToDir(payload map[string]FileProjection, dir
if fileProjection.FsUser == nil {
continue
}
if err := os.Chown(fullPath, int(*fileProjection.FsUser), -1); err != nil {
klog.Errorf("%s: unable to change file %s with owner %v: %v", w.logContext, fullPath, int(*fileProjection.FsUser), err)
return err
if isNotWindows {
if err := os.Chown(fullPath, int(*fileProjection.FsUser), -1); err != nil {
klog.Errorf("%s: unable to change file %s with owner %v: %v", w.logContext, fullPath, int(*fileProjection.FsUser), err)
return err
}
}
}

Expand Down

0 comments on commit cd34728

Please sign in to comment.