mirror of https://github.com/containers/podman.git
pkg/domain: Make checkExecPreserveFDs platform-specific
Also add a FreeBSD version. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
parent
f36b3bc811
commit
4c1294ccb7
|
@ -870,7 +870,7 @@ func makeExecConfig(options entities.ExecOptions, rt *libpod.Runtime) (*libpod.E
|
||||||
|
|
||||||
func checkExecPreserveFDs(options entities.ExecOptions) error {
|
func checkExecPreserveFDs(options entities.ExecOptions) error {
|
||||||
if options.PreserveFDs > 0 {
|
if options.PreserveFDs > 0 {
|
||||||
entries, err := os.ReadDir("/proc/self/fd")
|
entries, err := os.ReadDir(processFileDescriptorsPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -879,7 +879,7 @@ func checkExecPreserveFDs(options entities.ExecOptions) error {
|
||||||
for _, e := range entries {
|
for _, e := range entries {
|
||||||
i, err := strconv.Atoi(e.Name())
|
i, err := strconv.Atoi(e.Name())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot parse %s in /proc/self/fd: %w", e.Name(), err)
|
return fmt.Errorf("cannot parse %s in %s: %w", e.Name(), processFileDescriptorsPath, err)
|
||||||
}
|
}
|
||||||
m[i] = true
|
m[i] = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package abi
|
||||||
|
|
||||||
|
const processFileDescriptorsPath = "/dev/fd"
|
|
@ -0,0 +1,3 @@
|
||||||
|
package abi
|
||||||
|
|
||||||
|
const processFileDescriptorsPath = "/proc/self/fd"
|
Loading…
Reference in New Issue