mirror of
https://github.com/containers/podman.git
synced 2025-06-27 13:38:49 +08:00
Merge pull request #6036 from giuseppe/fix-rootlessport-panic
rootlessport: use two different channels
This commit is contained in:
@ -102,25 +102,27 @@ func parent() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sigC := make(chan os.Signal, 1)
|
exitC := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigC, unix.SIGPIPE)
|
defer close(exitC)
|
||||||
defer func() {
|
|
||||||
// dummy signal to terminate the goroutine
|
|
||||||
sigC <- unix.SIGKILL
|
|
||||||
}()
|
|
||||||
go func() {
|
go func() {
|
||||||
|
sigC := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(sigC, unix.SIGPIPE)
|
||||||
defer func() {
|
defer func() {
|
||||||
signal.Stop(sigC)
|
signal.Stop(sigC)
|
||||||
close(sigC)
|
close(sigC)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
s := <-sigC
|
select {
|
||||||
if s == unix.SIGPIPE {
|
case s := <-sigC:
|
||||||
if f, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755); err == nil {
|
if s == unix.SIGPIPE {
|
||||||
unix.Dup2(int(f.Fd()), 1) // nolint:errcheck
|
if f, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755); err == nil {
|
||||||
unix.Dup2(int(f.Fd()), 2) // nolint:errcheck
|
unix.Dup2(int(f.Fd()), 1) // nolint:errcheck
|
||||||
f.Close()
|
unix.Dup2(int(f.Fd()), 2) // nolint:errcheck
|
||||||
|
f.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
case <-exitC:
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -216,6 +216,8 @@ func ParseNetworkNamespace(ns string) (Namespace, []string, error) {
|
|||||||
toReturn := Namespace{}
|
toReturn := Namespace{}
|
||||||
var cniNetworks []string
|
var cniNetworks []string
|
||||||
switch {
|
switch {
|
||||||
|
case ns == "slirp4netns":
|
||||||
|
toReturn.NSMode = Slirp
|
||||||
case ns == "pod":
|
case ns == "pod":
|
||||||
toReturn.NSMode = FromPod
|
toReturn.NSMode = FromPod
|
||||||
case ns == "bridge":
|
case ns == "bridge":
|
||||||
|
Reference in New Issue
Block a user