summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-08-10 15:19:02 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-08-11 11:12:44 +0200
commitc72bb4f8feb05a63c189fe6ce264ca652b399022 (patch)
tree1dd54206f46cba6e72cca5470a6b5da789007c3d /pkg
parent9a9ad853cb6781460829cb139cecbf9aff37896d (diff)
downloadpodman-c72bb4f8feb05a63c189fe6ce264ca652b399022.tar.gz
podman-c72bb4f8feb05a63c189fe6ce264ca652b399022.tar.bz2
podman-c72bb4f8feb05a63c189fe6ce264ca652b399022.zip
generate systemd: fix error handling
Fix a bug in the error handling which returned nil instead of an error and ultimately lead to nil dereferences in the client. To prevent future regressions, add a test and check for the error message. Fixes: #7271 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/abi/generate.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go
index 560be988b..cff09bf2d 100644
--- a/pkg/domain/infra/abi/generate.go
+++ b/pkg/domain/infra/abi/generate.go
@@ -20,9 +20,10 @@ func (ic *ContainerEngine) GenerateSystemd(ctx context.Context, nameOrID string,
if ctrErr == nil {
// Generate the unit for the container.
s, err := generate.ContainerUnit(ctr, options)
- if err == nil {
- return &entities.GenerateSystemdReport{Output: s}, nil
+ if err != nil {
+ return nil, err
}
+ return &entities.GenerateSystemdReport{Output: s}, nil
}
// If it's not a container, we either have a pod or garbage.