-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix posix permissions build constraints (#7956)
- Loading branch information
1 parent
d44d961
commit c15ff92
Showing
6 changed files
with
138 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package local | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func getUmask() int { | ||
if umask < 0 { | ||
umask = syscall.Umask(0) | ||
syscall.Umask(umask) | ||
} | ||
return umask | ||
} | ||
|
||
func permissionsFromFileInfo(info os.FileInfo) (*POSIXPermissions, error) { | ||
stat, ok := info.Sys().(*syscall.Stat_t) | ||
if !ok { | ||
return nil, ErrUnsupportedFS | ||
} | ||
|
||
defaultOwnership = &POSIXOwnership{ | ||
UID: int(stat.Uid), | ||
GID: int(stat.Gid), | ||
} | ||
|
||
return &POSIXPermissions{ | ||
Mode: os.FileMode(stat.Mode), | ||
POSIXOwnership: *defaultOwnership, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package local | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func getUmask() int { | ||
if umask < 0 { | ||
umask = syscall.Umask(0) | ||
syscall.Umask(umask) | ||
} | ||
return umask | ||
} | ||
|
||
func permissionsFromFileInfo(info os.FileInfo) (*POSIXPermissions, error) { | ||
stat, ok := info.Sys().(*syscall.Stat_t) | ||
if !ok { | ||
return nil, ErrUnsupportedFS | ||
} | ||
|
||
defaultOwnership = &POSIXOwnership{ | ||
UID: int(stat.Uid), | ||
GID: int(stat.Gid), | ||
} | ||
|
||
return &POSIXPermissions{ | ||
Mode: os.FileMode(stat.Mode), | ||
POSIXOwnership: *defaultOwnership, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package local | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func getUmask() int { | ||
if umask < 0 { | ||
umask = syscall.Umask(0) | ||
syscall.Umask(umask) | ||
} | ||
return umask | ||
} | ||
|
||
func permissionsFromFileInfo(info os.FileInfo) (*POSIXPermissions, error) { | ||
stat, ok := info.Sys().(*syscall.Stat_t) | ||
if !ok { | ||
return nil, ErrUnsupportedFS | ||
} | ||
|
||
defaultOwnership = &POSIXOwnership{ | ||
UID: int(stat.Uid), | ||
GID: int(stat.Gid), | ||
} | ||
|
||
return &POSIXPermissions{ | ||
Mode: os.FileMode(stat.Mode), | ||
POSIXOwnership: *defaultOwnership, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package local | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func getUmask() int { | ||
if umask < 0 { | ||
umask = syscall.Umask(0) | ||
syscall.Umask(umask) | ||
} | ||
return umask | ||
} | ||
|
||
func permissionsFromFileInfo(info os.FileInfo) (*POSIXPermissions, error) { | ||
stat, ok := info.Sys().(*syscall.Stat_t) | ||
if !ok { | ||
return nil, ErrUnsupportedFS | ||
} | ||
|
||
defaultOwnership = &POSIXOwnership{ | ||
UID: int(stat.Uid), | ||
GID: int(stat.Gid), | ||
} | ||
|
||
return &POSIXPermissions{ | ||
Mode: os.FileMode(stat.Mode), | ||
POSIXOwnership: *defaultOwnership, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package local | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func getUmask() int { | ||
return 0 | ||
} | ||
|
||
func permissionsFromFileInfo(info os.FileInfo) (*POSIXPermissions, error) { | ||
return nil, ErrUnsupportedFS | ||
} |