Browse Source

openrc-0.28-26: fix waitpid checks -> 238042d28b

milky-way-v0.3
André Silva 8 months ago
parent
commit
d37be6a899
2 changed files with 102 additions and 1 deletions
  1. +95
    -0
      openrc/0012-openrc-init-fix-waitpid-checks.patch
  2. +7
    -1
      openrc/PKGBUILD

+ 95
- 0
openrc/0012-openrc-init-fix-waitpid-checks.patch View File

@@ -0,0 +1,95 @@
diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c
index eb346f5..0016dc2 100644
--- a/src/rc/openrc-init.c
+++ b/src/rc/openrc-init.c
@@ -37,40 +37,45 @@
static const char *rc_default_runlevel = "default";
-static pid_t do_openrc(const char *runlevel)
+static void do_openrc(const char *runlevel)
{
pid_t pid;
- sigset_t signals;
+ sigset_t all_signals;
+ sigset_t our_signals;
+ sigfillset(&all_signals);
+ /* block all signals */
+ sigprocmask(SIG_BLOCK, &all_signals, &our_signals);
pid = fork();
switch(pid) {
case -1:
perror("fork");
+ exit(1);
break;
case 0:
setsid();
/* unblock all signals */
- sigemptyset(&signals);
- sigprocmask(SIG_SETMASK, &signals, NULL);
+ sigprocmask(SIG_UNBLOCK, &all_signals, NULL);
printf("Starting %s runlevel\n", runlevel);
execl("/sbin/openrc", "/sbin/openrc", runlevel, NULL);
perror("exec");
+ exit(1);
break;
default:
+ /* restore our signal mask */
+ sigprocmask(SIG_SETMASK, &our_signals, NULL);
+ while (waitpid(pid, NULL, 0) != pid)
+ if (errno == ECHILD)
+ break;
break;
}
- return pid;
}
static void init(const char *default_runlevel)
{
const char *runlevel = NULL;
- pid_t pid;
-
- pid = do_openrc("sysinit");
- waitpid(pid, NULL, 0);
- pid = do_openrc("boot");
- waitpid(pid, NULL, 0);
+ do_openrc("sysinit");
+ do_openrc("boot");
if (default_runlevel)
runlevel = default_runlevel;
else
@@ -81,8 +86,7 @@ static void init(const char *default_runlevel)
printf("%s is an invalid runlevel\n", runlevel);
runlevel = rc_default_runlevel;
}
- pid = do_openrc(runlevel);
- waitpid(pid, NULL, 0);
+ do_openrc(runlevel);
log_wtmp("reboot", "~~", 0, RUN_LVL, "~~");
}
@@ -94,10 +98,7 @@ static void handle_reexec(char *my_name)
static void handle_shutdown(const char *runlevel, int cmd)
{
- pid_t pid;
-
- pid = do_openrc(runlevel);
- while (waitpid(pid, NULL, 0) != pid);
+ do_openrc(runlevel);
printf("Sending the final term signal\n");
kill(-1, SIGTERM);
sleep(3);
@@ -109,10 +110,7 @@ static void handle_shutdown(const char *runlevel, int cmd)
static void handle_single(void)
{
- pid_t pid;
-
- pid = do_openrc("single");
- while (waitpid(pid, NULL, 0) != pid);
+ do_openrc("single");
}
static void reap_zombies(void)

+ 7
- 1
openrc/PKGBUILD View File

@@ -8,7 +8,7 @@ pkgname=('openrc' 'openrc-sysvcompat')
pkgver=0.28
_debver=0.27
_debrel=1
pkgrel=25
pkgrel=26
arch=('i686' 'x86_64')
url='https://wiki.gentoo.org/wiki/Project:OpenRC'
license=('Simplified-BSD')
@@ -29,6 +29,7 @@ source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/OpenRC/openrc/archive/$
'0009-remove-dangerous-local-init-script.patch'
'0010-add-hidepid-support-in-proc-filesystem.patch'
'0011-load-defined-list-of-kernel-modules-from-modules.d-folder.patch'
'0012-openrc-init-fix-waitpid-checks.patch'
'chroot.confd'
'chroot.initd')
sha512sums=('a10c293bf4287bcc4ffb9c996cbc1294f979483ea9fb2efb0dd1becee193f49ff114530c078850e8c11cf2c0a812be2e74801352fdbfe313b90cd9af5b8ccf93'
@@ -47,6 +48,7 @@ sha512sums=('a10c293bf4287bcc4ffb9c996cbc1294f979483ea9fb2efb0dd1becee193f49ff11
'e8240d642ab60fb59e7709cf273091300d3af36949f29ba44a7043f402b8b0dc96056ac1f227c1360ce178a26241dc9246b21f11b921c78d09aa18a5246e1256'
'8310892eb509403787c6c2ff23ffcf7980cab4f7db7c2ce15dc7a9c931e49e5518b4602e2ea5e434da45a5bbaea960e198ab6915908dc70ec9a1e6c0d4a495fc'
'3764eab1e87ecb7b438bd6acf0c7223f6f791d65509a7f4d2f7879c3b0eeecdbe8beedf3a34a86876c468c61caeb8c15ff8626cbcc4f66a802eb843ffc14ab59'
'a07954b4ab6522965e85fc841250b63085a5ffd13d413ca4140e44e64f83c070a1d223cad0fc841eafef8c13a0eefad9b85589dd3dd3e7a65171e50abd53fc1b'
'b5bd2277d174a359e0a118db46f2f774b232509edcf068d24fe26d5e8e931a1f73aaa7819f6ca5908ba77b7a531395c2b3463d6a7e2a6d608f891bd060681e13'
'ab972ac137df3a5f1fbbd14452c4a38098c022e0af054f7d0dc9685b6113e1edde131e7fd4788be7fd4be6e603a185bb979a7d65ae9f858b04eaa9cb6e39dacd')

@@ -135,6 +137,10 @@ prepare() {

# load defined list of kernel modules from modules.d folder
patch -p1 -i ../0011-load-defined-list-of-kernel-modules-from-modules.d-folder.patch

# fix waitpid checks
# https://github.com/OpenRC/openrc/commit/238042d28b85277a4b5f19c3d13c4331b1325662
patch -p1 -i ../0012-openrc-init-fix-waitpid-checks.patch
}

build() {

Loading…
Cancel
Save