aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2021-08-14 10:28:14 -0700
committerAndrew G. Morgan <morgan@kernel.org>2021-08-14 10:28:14 -0700
commit686084897c15348f42bde8e4d3448edfc78ece79 (patch)
tree78f27214e5e326f4ada08763703087c5d22e435a
parentfd32fac5e3f13fe1b0b2a1cc22d8dfb5e608f2d7 (diff)
downloadlibcap-686084897c15348f42bde8e4d3448edfc78ece79.tar.gz
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>
-rw-r--r--libcap/cap_proc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libcap/cap_proc.c b/libcap/cap_proc.c
index 8116734..e12c8e6 100644
--- a/libcap/cap_proc.c
+++ b/libcap/cap_proc.c
@@ -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;
}