Commit 8836b7e8 authored by Kevin Daudt's avatar Kevin Daudt 💻

main/libvirt: fix lock issues

Fixes #11602
parent f6812249
Pipeline #35867 passed with stages
in 9 minutes and 5 seconds
......@@ -2,7 +2,7 @@
pkgname=libvirt
pkgver=6.6.0
_ver="${pkgver/_rc/-rc}"
pkgrel=0
pkgrel=1
pkgdesc="A virtualization API for several hypervisor and container systems"
url="https://libvirt.org/"
arch="all"
......@@ -33,6 +33,7 @@ source="https://libvirt.org/sources/libvirt-$pkgver.tar.xz
virtlockd.initd
musl-fix-includes.patch
stderr-fix.patch
libvirt-fork-usage.patch
"
if [ "$CARCH" = "x86_64" ]; then
subpackages="$subpackages $pkgname-xen"
......@@ -196,4 +197,5 @@ sha512sums="55091addcf43d3c0bdd50f9378b588351181d191272d5a19220a0babe0893c1f6e0f
36b85f473d292be8df415256d01a562131d8ae61450ba3893658090a12d589ca32215382f56f286a830b4e59ffd98fbe1d92004f2ce14ca0834451b943cd8f2f virtlogd.initd
a4c4d26e4111931acbe7594451bf963a36c8db33c64b1bc447ab4758bb92803510bebee0511d6bc16ba80c289ab6f87e74377d47bf560412f9adb9c161a206d9 virtlockd.initd
dfe042c596028125bf8548115de2922683829c4716f6b0efb8efc38518670e3e848481661b9714bb0664c1022b87e8f3c0773611fe10187b0bc588e2336ada0c musl-fix-includes.patch
d32551d56eae2c33bab7571964f76421336967918c293cd1d18fc66626a7ead3551b5672a9e3fc3d8b7bca82cc0abb17e428ee8271d04d73bc06fd16309918b3 stderr-fix.patch"
d32551d56eae2c33bab7571964f76421336967918c293cd1d18fc66626a7ead3551b5672a9e3fc3d8b7bca82cc0abb17e428ee8271d04d73bc06fd16309918b3 stderr-fix.patch
e27eef6ae895bf27677c909d8cb9a3ebe9eea6a544597240a41b7645225a85a075f0c9311478cbb674ba46d03497accffa0983ef0a60dee7db8a84eb4303fd42 libvirt-fork-usage.patch"
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 76f7eb9a3d..a73fa222c6 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -719,18 +719,12 @@ virExec(virCommandPtr cmd)
goto fork_error;
if (prepareStdFd(childin, STDIN_FILENO) < 0) {
- virReportSystemError(errno,
- "%s", _("failed to setup stdin file handle"));
goto fork_error;
}
if (childout > 0 && prepareStdFd(childout, STDOUT_FILENO) < 0) {
- virReportSystemError(errno,
- "%s", _("failed to setup stdout file handle"));
goto fork_error;
}
if (childerr > 0 && prepareStdFd(childerr, STDERR_FILENO) < 0) {
- virReportSystemError(errno,
- "%s", _("failed to setup stderr file handle"));
goto fork_error;
}
@@ -743,9 +737,6 @@ virExec(virCommandPtr cmd)
VIR_FORCE_CLOSE(childerr);
VIR_FORCE_CLOSE(null);
- /* Initialize full logging for a while */
- virLogSetFromEnv();
-
if (cmd->pidfile &&
virPipe(pipesync) < 0)
goto fork_error;
@@ -756,21 +747,15 @@ virExec(virCommandPtr cmd)
char c;
if (setsid() < 0) {
- virReportSystemError(errno,
- "%s", _("cannot become session leader"));
goto fork_error;
}
if (chdir("/") < 0) {
- virReportSystemError(errno,
- "%s", _("cannot change to root directory"));
goto fork_error;
}
pid = fork();
if (pid < 0) {
- virReportSystemError(errno,
- "%s", _("cannot fork child process"));
goto fork_error;
}
@@ -779,8 +764,6 @@ virExec(virCommandPtr cmd)
* exiting. Wait here for the child to write it and signal us. */
if (cmd->pidfile &&
saferead(pipesync[0], &c, sizeof(c)) != sizeof(c)) {
- virReportSystemError(errno, "%s",
- _("Unable to wait for child process"));
_exit(EXIT_FAILURE);
}
_exit(EXIT_SUCCESS);
@@ -804,14 +787,11 @@ virExec(virCommandPtr cmd)
if (pidfilefd < 0)
goto fork_error;
if (virSetInherit(pidfilefd, true) < 0) {
- virReportSystemError(errno, "%s",
- _("Cannot disable close-on-exec flag"));
goto fork_error;
}
c = '1';
if (safewrite(pipesync[1], &c, sizeof(c)) != sizeof(c)) {
- virReportSystemError(errno, "%s", _("Unable to notify child process"));
goto fork_error;
}
VIR_FORCE_CLOSE(pipesync[0]);
@@ -821,9 +801,7 @@ virExec(virCommandPtr cmd)
}
if (cmd->hook) {
- VIR_DEBUG("Run hook %p %p", cmd->hook, cmd->opaque);
ret = cmd->hook(cmd->opaque);
- VIR_DEBUG("Done hook %d", ret);
if (ret < 0)
goto fork_error;
}
@@ -860,18 +838,12 @@ virExec(virCommandPtr cmd)
if (virCommandHandshakeChild(cmd) < 0)
goto fork_error;
- /* Close logging again to ensure no FDs leak to child */
- virLogReset();
-
if (cmd->env)
execve(binary, cmd->args, cmd->env);
else
execv(binary, cmd->args);
ret = errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE;
- virReportSystemError(errno,
- _("cannot execute binary %s"),
- cmd->args[0]);
fork_error:
virDispatchError(NULL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment