libpod: fix FreeBSD 'podman-remote top' default behaviour

use the 'pf -ef' compatible default when the descriptor argument
of Top() is []string{""} or []string{}

why:

the call to Top() in

pkg/api/handlers/compat/containers_top.go#L62C3-L62C3

passes []string{""} descriptors whenever ps_args is empty (the
default value for libpod requests) because of golang strings.Split()
semantics.

[NO NEW TESTS NEEDED]

Signed-off-by: Stefan Grundmann <sg2342@googlemail.com>
This commit is contained in:
Stefan Grundmann
2023-07-17 17:01:12 +00:00
parent 87f5a15d62
commit a6a207673e

@ -43,7 +43,7 @@ func (c *Container) Top(descriptors []string) ([]string, error) {
}
// Default to 'ps -ef' compatible descriptors
if len(descriptors) == 0 {
if len(strings.Join(descriptors, "")) == 0 {
descriptors = []string{"user", "pid", "ppid", "pcpu", "etime", "tty", "time", "args"}
}