Skip to content

Commit

Permalink
container, error: update error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
  • Loading branch information
eriksjolund committed Feb 11, 2025
1 parent 4e51077 commit ec0c304
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -2687,7 +2687,10 @@ libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_

ret = close_and_reset (&sync_socket);
if (UNLIKELY (ret < 0))
goto fail;
{
crun_make_error (err, errno, "close/reset of sync_socket failed");
goto fail;
}

libcrun_debug ("Writing container status");
ret = write_container_status (container, context, pid, cgroup_status, err);
Expand Down Expand Up @@ -2715,7 +2718,10 @@ libcrun_container_run_internal (libcrun_container_t *container, libcrun_context_

ret = close_and_reset (&own_seccomp_receiver_fd);
if (UNLIKELY (ret < 0))
goto fail;
{
crun_make_error (err, errno, "close/reset of seccomp receiver fd failed");
goto fail;
}
}

{
Expand Down
12 changes: 9 additions & 3 deletions src/libcrun/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ crun_error_wrap (libcrun_error_t *err, const char *fmt, ...)
int ret;

if (err == NULL || *err == NULL)
return 0;
{
// Internal error
return 0;
}

ret = -(*err)->status - 1;

Expand Down Expand Up @@ -123,8 +126,11 @@ crun_error_write_warning_and_release (FILE *out, libcrun_error_t **err)

if (out == NULL)
out = stderr;
if (err == NULL || *err == NULL)
return;
if (err == NULL || *err != NULL || **err != NULL)
{
// Internal error
return;
}

ref = **err;
if (ref->status)
Expand Down

0 comments on commit ec0c304

Please sign in to comment.