diff --git a/.gitignore b/.gitignore index bc2012c57d..3a151bbe9a 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ tests/tests_* tests/*.log tests/*.trs test-suite.log +tags diff --git a/src/libcrun/container.c b/src/libcrun/container.c index a918628ab8..6fe8a65e2c 100644 --- a/src/libcrun/container.c +++ b/src/libcrun/container.c @@ -1206,6 +1206,13 @@ container_init_setup (void *args, pid_t own_pid, char *notify_socket, int sync_s } } + // set primary process to 1 explicitly if nothing is configured and LISTEN_FD is not set + if (getenv ("LISTEN_PID") == NULL && entrypoint_args->context->preserve_fds == 0) + { + setenv ("LISTEN_PID", "1", 1); + libcrun_warning ("setting LISTEN_PID=1 since no previous configuration was found"); + } + if (def->process && def->process->cwd) if (UNLIKELY (chdir (def->process->cwd) < 0)) return crun_make_error (err, errno, "chdir");