mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
libpod: Avoid a nil dereference when generating resolv.conf on FreeBSD
The code which generates resolv.conf dereferenced c.config.Spec.Linux and this field is not set for FreeBSD containers. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
@ -1939,11 +1939,16 @@ func (c *Container) generateResolvConf() error {
|
|||||||
|
|
||||||
destPath := filepath.Join(c.state.RunDir, "resolv.conf")
|
destPath := filepath.Join(c.state.RunDir, "resolv.conf")
|
||||||
|
|
||||||
|
var namespaces []spec.LinuxNamespace
|
||||||
|
if c.config.Spec.Linux != nil {
|
||||||
|
namespaces = c.config.Spec.Linux.Namespaces
|
||||||
|
}
|
||||||
|
|
||||||
if err := resolvconf.New(&resolvconf.Params{
|
if err := resolvconf.New(&resolvconf.Params{
|
||||||
IPv6Enabled: ipv6,
|
IPv6Enabled: ipv6,
|
||||||
KeepHostServers: keepHostServers,
|
KeepHostServers: keepHostServers,
|
||||||
Nameservers: nameservers,
|
Nameservers: nameservers,
|
||||||
Namespaces: c.config.Spec.Linux.Namespaces,
|
Namespaces: namespaces,
|
||||||
Options: options,
|
Options: options,
|
||||||
Path: destPath,
|
Path: destPath,
|
||||||
Searches: search,
|
Searches: search,
|
||||||
|
Reference in New Issue
Block a user