From 4f0ad4d18273a5e2b473056932604ee9e06b0026 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 08 2020 11:32:33 +0000 Subject: Apply patch glibc-rh1747502-9.patch patch_name: glibc-rh1747502-9.patch present_in_specfile: true location_in_specfile: 214 --- diff --git a/support/test-container.c b/support/test-container.c index b58f0f7..fe0ebbd 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -866,6 +866,43 @@ main (int argc, char **argv) } } + if (do_postclean) + { + pid_t pc_pid = fork (); + + if (pc_pid < 0) + { + FAIL_EXIT1 ("Can't fork for post-clean"); + } + else if (pc_pid > 0) + { + /* Parent. */ + int status; + waitpid (pc_pid, &status, 0); + + /* Child has exited, we can post-clean the test root. */ + printf("running post-clean rsync\n"); + rsync (pristine_root_path, new_root_path, 1); + + if (WIFEXITED (status)) + exit (WEXITSTATUS (status)); + + if (WIFSIGNALED (status)) + { + printf ("%%SIGNALLED%%\n"); + exit (77); + } + + printf ("%%EXITERROR%%\n"); + exit (78); + } + + /* Child continues. */ + } + + /* This is the last point in the program where we're still in the + "normal" namespace. */ + #ifdef CLONE_NEWNS /* The unshare here gives us our own spaces and capabilities. */ if (unshare (CLONE_NEWUSER | CLONE_NEWPID | CLONE_NEWNS) < 0) @@ -914,14 +951,6 @@ main (int argc, char **argv) int status; waitpid (child, &status, 0); - /* There's a bit of magic here, since the buildroot is mounted - in our space, the paths are still valid, and since the mounts - aren't recursive, it sees *only* the built root, not anything - we would normally se if we rsync'd to "/" like mounted /dev - files. */ - if (do_postclean) - rsync (pristine_root_path, new_root_path, 1); - if (WIFEXITED (status)) exit (WEXITSTATUS (status));