Skip to content

Commit 3f29052

Browse files
committed
linux: do not use errno without failure
Closes: containers#1994 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent 96136b3 commit 3f29052

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/libcrun/linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3971,7 +3971,7 @@ expect_success_from_sync_socket (int sync_fd, libcrun_error_t *err)
39713971

39723972
ret = TEMP_FAILURE_RETRY (read (sync_fd, &res, sizeof (res)));
39733973
if (UNLIKELY (ret != sizeof (res)))
3974-
return crun_make_error (err, errno, "read status from sync socket");
3974+
return crun_make_error (err, ret < 0 ? errno : 0, "read status from sync socket");
39753975

39763976
if (res == 0)
39773977
return 0;
@@ -5173,7 +5173,7 @@ libcrun_run_linux_container (libcrun_container_t *container, container_entrypoin
51735173

51745174
ret = TEMP_FAILURE_RETRY (read (sync_socket_host, &new_pid, sizeof (new_pid)));
51755175
if (UNLIKELY (ret != sizeof (new_pid)))
5176-
return crun_make_error (err, errno, "read pid from sync socket");
5176+
return crun_make_error (err, ret < 0 ? errno : 0, "read pid from sync socket");
51775177

51785178
/* Cleanup the first process. */
51795179
ret = waitpid_ignore_stopped (pid, NULL, 0);

0 commit comments

Comments
 (0)