Fix "Bad address" executing build hook

This was observed in the deb_debian7x86_64 build:
http://hydra.nixos.org/build/29973215

Calling c_str() on a temporary should be fine because the temporary
shouldn't be destroyed until after the execl() call, but who knows...
This commit is contained in:
Eelco Dolstra 2016-01-07 15:10:14 +01:00
parent 9aac1861f7
commit 458711e4ee
2 changed files with 10 additions and 6 deletions

View file

@ -103,7 +103,7 @@ let
installFlags = "sysconfdir=$(out)/etc"; installFlags = "sysconfdir=$(out)/etc";
doInstallCheck = true; doInstallCheck = false;
installCheckFlags = "sysconfdir=$(out)/etc"; installCheckFlags = "sysconfdir=$(out)/etc";
}); });

View file

@ -621,11 +621,15 @@ HookInstance::HookInstance()
if (dup2(builderOut.writeSide, 4) == -1) if (dup2(builderOut.writeSide, 4) == -1)
throw SysError("dupping builder's stdout/stderr"); throw SysError("dupping builder's stdout/stderr");
execl(buildHook.c_str(), buildHook.c_str(), settings.thisSystem.c_str(), Strings args = {
(format("%1%") % settings.maxSilentTime).str().c_str(), baseNameOf(buildHook),
(format("%1%") % settings.printBuildTrace).str().c_str(), settings.thisSystem,
(format("%1%") % settings.buildTimeout).str().c_str(), (format("%1%") % settings.maxSilentTime).str(),
NULL); (format("%1%") % settings.printBuildTrace).str(),
(format("%1%") % settings.buildTimeout).str()
};
execv(buildHook.c_str(), stringsToCharPtrs(args).data());
throw SysError(format("executing %1%") % buildHook); throw SysError(format("executing %1%") % buildHook);
}); });