Complete cap_launch fix.

Samanta Navarro included this in their suggested fix, but I missed
including it in the previous commit. Fixed now.

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
This commit is contained in:
Andrew G. Morgan 2021-08-14 10:28:14 -07:00
parent fd32fac5e3
commit 686084897c

View File

@ -878,6 +878,7 @@ static int _cap_chroot(struct syscaller_s *sc, const char *root)
__attribute__ ((noreturn))
static void _cap_launch(int fd, cap_launch_t attr, void *detail) {
struct syscaller_s *sc = &singlethread;
int my_errno;
if (attr->custom_setup_fn && attr->custom_setup_fn(detail)) {
goto defer;
@ -919,8 +920,9 @@ defer:
* getting here means an error has occurred and errno is
* communicated to the parent
*/
my_errno = errno;
for (;;) {
int n = write(fd, &errno, sizeof(errno));
int n = write(fd, &my_errno, sizeof(my_errno));
if (n < 0 && errno == EAGAIN) {
continue;
}