Handle empty root in config

If the config.toml has an empty root specified, this could be
passed to the NVIDIA Container CLI through the --root flag
which causes argument parsing to fail. This change only
adds the --root flag if the config option is specified
and is non-empty.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-07-19 13:12:20 +02:00
parent 80a78e60d1
commit e51621aa7f
2 changed files with 15 additions and 2 deletions

View File

@@ -92,7 +92,7 @@ func doPrestart() {
rootfs := getRootfsPath(container)
args := []string{getCLIPath(cli)}
if cli.Root != nil {
if cli.Root != nil && *cli.Root != "" {
args = append(args, fmt.Sprintf("--root=%s", *cli.Root))
}
if cli.LoadKmods {