diff options
author | Doug Rabson <dfr@rabson.org> | 2022-09-06 11:58:33 +0100 |
---|---|---|
committer | Doug Rabson <dfr@rabson.org> | 2022-09-12 16:08:56 +0100 |
commit | 369d86040e82d7940f94a582336bed7ad9a19c6c (patch) | |
tree | e6b996e71ae2768d272caf6e2347ebc97c3bb59f /libpod | |
parent | 5abc08df252037e2984a2b532f17ba78fdd876d4 (diff) | |
download | podman-369d86040e82d7940f94a582336bed7ad9a19c6c.tar.gz podman-369d86040e82d7940f94a582336bed7ad9a19c6c.tar.bz2 podman-369d86040e82d7940f94a582336bed7ad9a19c6c.zip |
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>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal_common.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libpod/container_internal_common.go b/libpod/container_internal_common.go index f1d3f5e89..62cc57815 100644 --- a/libpod/container_internal_common.go +++ b/libpod/container_internal_common.go @@ -1939,11 +1939,16 @@ func (c *Container) generateResolvConf() error { 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{ IPv6Enabled: ipv6, KeepHostServers: keepHostServers, Nameservers: nameservers, - Namespaces: c.config.Spec.Linux.Namespaces, + Namespaces: namespaces, Options: options, Path: destPath, Searches: search, |