Merge pull request #1983 from giuseppe/return-error-from-container-init

container: do not release returned error
This commit is contained in:
Giuseppe Scrivano
2026-02-05 09:32:14 +01:00
committed by GitHub
2 changed files with 8 additions and 5 deletions

View File

@@ -1577,10 +1577,13 @@ container_init (void *args, char *notify_socket, int sync_socket, libcrun_error_
{
/* If it fails to write the error using the sync socket, then fallback
to stderr. */
if (sync_socket_write_error (sync_socket, err) < 0)
return ret;
crun_error_release (err);
if (sync_socket_write_error (sync_socket, err) == 0)
{
crun_error_release (err);
/* A return value of > 0 means to fail with an error without err being set so to avoid
printing it twice. */
return 1;
}
return ret;
}

View File

@@ -5268,7 +5268,7 @@ libcrun_run_linux_container (libcrun_container_t *container, container_entrypoin
if (*err)
libcrun_fail_with_error ((*err)->status, "%s", (*err)->msg);
/* If cursor is here most likely we returned from a custom handler eg. wasm, libkrun */
/* If we got here likely we returned from a custom handler eg. wasm, libkrun */
/* Allow cleanup attributes to perform cleanup and exit with success if return code was 0 */
if (ret == 0)
_safe_exit (EXIT_SUCCESS);