Use rpm.spawn instead of posix.fork if availabe (#2291869)

This commit is contained in:
Florian Weimer 2024-10-28 13:17:37 +01:00
parent 1fcc972d48
commit a766afca02

View File

@ -99,13 +99,21 @@
-- Open-code rpm.execute with error message handling. -- Open-code rpm.execute with error message handling.
function post_exec (msg, program, ...) function post_exec (msg, program, ...)
local pid = posix.fork () if rpm.spawn ~= nil then
if pid == 0 then local status = rpm.spawn ({program, ...})
posix.exec (program, ...) if status == nil then
io.stdout:write (msg) io.stdout:write (msg)
assert (nil) assert (nil)
elseif pid > 0 then end
posix.wait (pid) else
local pid = posix.fork ()
if pid == 0 then
posix.exec (program, ...)
io.stdout:write (msg)
assert (nil)
elseif pid > 0 then
posix.wait (pid)
end
end end
end end
@ -144,7 +152,7 @@ Version: %{glibcversion}
# - It allows using the Release number without the %%dist tag in the dependency # - It allows using the Release number without the %%dist tag in the dependency
# generator to make the generated requires interchangeable between Rawhide # generator to make the generated requires interchangeable between Rawhide
# and ELN (.elnYY < .fcXX). # and ELN (.elnYY < .fcXX).
%global baserelease 14 %global baserelease 15
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
# Licenses: # Licenses:
@ -2122,12 +2130,17 @@ update_gconv_modules_cache()
if tonumber(arg[2]) >= 2 if tonumber(arg[2]) >= 2
and posix.access("%{_prefix}/bin/systemctl", "x") and posix.access("%{_prefix}/bin/systemctl", "x")
then then
local pid = posix.fork() if rpm.spawn ~= nil then
if pid == 0 then rpm.spawn ({"%{_prefix}/bin/systemctl", "daemon-reexec"},
posix.redirect2null(2) {stderr="/dev/null"})
posix.exec("%{_prefix}/bin/systemctl", "daemon-reexec") else
elseif pid > 0 then local pid = posix.fork()
posix.wait(pid) if pid == 0 then
posix.redirect2null(2)
posix.exec("%{_prefix}/bin/systemctl", "daemon-reexec")
elseif pid > 0 then
posix.wait(pid)
end
end end
end end
@ -2340,6 +2353,9 @@ update_gconv_modules_cache ()
%endif %endif
%changelog %changelog
* Mon Oct 28 2024 Florian Weimer <fweimer@redhat.com> - 2.40.9000-15
- Use rpm.spawn instead of posix.fork if availabe (#2291869)
* Mon Oct 28 2024 Florian Weimer <fweimer@redhat.com> - 2.40.9000-14 * Mon Oct 28 2024 Florian Weimer <fweimer@redhat.com> - 2.40.9000-14
- Eliminate the glibc-headers package - Eliminate the glibc-headers package