mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 00:18:27 +00:00
* Add safe mkdirall and open * Use secure as much as possible and merge gomodules for orbit to fleet * Improve openfile and mkdirall to check for permissiveness instead of equality * Don't shift * Fix links * Address review comments
28 lines
764 B
Go
28 lines
764 B
Go
//+build !windows
|
|
|
|
package platform
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/fleetdm/fleet/v4/orbit/pkg/constant"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// ChmodExecutableDirectory sets the appropriate permissions on an executable
|
|
// file. On POSIX this is a normal chmod call.
|
|
func ChmodExecutableDirectory(path string) error {
|
|
if err := os.Chmod(path, constant.DefaultDirMode); err != nil {
|
|
return errors.Wrap(err, "chmod executable directory")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ChmodExecutable sets the appropriate permissions on the parent directory of
|
|
// an executable file. On POSIX this is a regular chmod call.
|
|
func ChmodExecutable(path string) error {
|
|
if err := os.Chmod(path, constant.DefaultExecutableMode); err != nil {
|
|
return errors.Wrap(err, "chmod executable")
|
|
}
|
|
return nil
|
|
}
|