Skip to content

Commit 357d650

Browse files
authored
Merge pull request #1920 from eriksjolund/handle_open_error
linux: handle openat error
2 parents 506e3d0 + d2b0060 commit 357d650

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libcrun/linux.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,9 +2662,11 @@ make_parent_mount_private (const char *rootfs, libcrun_error_t *err)
26622662
parentfd = openat (rootfsfd, "..", O_PATH | O_CLOEXEC);
26632663
if (parentfd < 0)
26642664
{
2665+
int saved_errno = errno;
26652666
ret = faccessat (rootfsfd, "..", X_OK, AT_EACCESS);
26662667
if (ret != 0)
26672668
return crun_make_error (err, EACCES, "make `%s` private: a component is not accessible", rootfs);
2669+
return crun_make_error (err, saved_errno, "make `%s` private: cannot open component", rootfs);
26682670
}
26692671

26702672
close_and_reset (&rootfsfd);

0 commit comments

Comments
 (0)