[NO NEW TESTS NEEDED] [FreeBSD] Fix crash when running podman inspect

When preparing container inspection output, ensure we actually have masked paths to work with.
These will only be available on Linux, which is no longer always true as we also support FreeBSD now.

Fixes #21117

Signed-off-by: Ben Cooksley <bcooksley@kde.org>
This commit is contained in:
Ben Cooksley 2024-01-14 20:28:20 +13:00
parent a2fcca4066
commit 971f2eb45a
1 changed files with 1 additions and 1 deletions

View File

@ -315,7 +315,7 @@ func (c *Container) GetSecurityOptions() []string {
if apparmor, ok := ctrSpec.Annotations[define.InspectAnnotationApparmor]; ok {
SecurityOpt = append(SecurityOpt, fmt.Sprintf("apparmor=%s", apparmor))
}
if c.config.Spec.Linux.MaskedPaths == nil {
if c.config.Spec != nil && c.config.Spec.Linux != nil && c.config.Spec.Linux.MaskedPaths == nil {
SecurityOpt = append(SecurityOpt, "unmask=all")
}