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..c1f4913a36 100644 --- a/src/libcrun/container.c +++ b/src/libcrun/container.c @@ -1187,6 +1187,13 @@ container_init_setup (void *args, pid_t own_pid, char *notify_socket, int sync_s if (clearenv ()) return crun_make_error (err, errno, "clearenv"); + // 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) { size_t i;