cleanup: add ChildName to UtilCreateChildProcess error message (#13103)

* cleanup: add ChildName to UtilCreateChildProcess error message

* tweak error message

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This commit is contained in:
Ben Hillis 2025-06-13 14:20:18 -07:00 committed by GitHub
parent b9a52e96c7
commit 1f0e66d25c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 17 deletions

View File

@ -1034,23 +1034,17 @@ try
if (Config.BootCommand.has_value()) if (Config.BootCommand.has_value())
{ {
const int ChildPid = UtilCreateChildProcess("BootCommand", [Command = Config.BootCommand.value(), SavedSignals = g_SavedSignalActions]() {
UtilCreateChildProcess("BootCommand", [Command = Config.BootCommand.value(), SavedSignals = g_SavedSignalActions]() { //
// // Restore default signal dispositions for the child process.
// Restore default signal dispositions for the child process. //
//
THROW_LAST_ERROR_IF(UtilSetSignalHandlers(SavedSignals, false) < 0); THROW_LAST_ERROR_IF(UtilSetSignalHandlers(SavedSignals, false) < 0);
THROW_LAST_ERROR_IF(UtilRestoreBlockedSignals() < 0); THROW_LAST_ERROR_IF(UtilRestoreBlockedSignals() < 0);
execl("/bin/sh", "sh", "-c", Command.c_str(), nullptr); execl("/bin/sh", "sh", "-c", Command.c_str(), nullptr);
LOG_ERROR("execl() failed, {}", errno); LOG_ERROR("execl() failed, {}", errno);
}); });
if (ChildPid < 0)
{
LOG_ERROR("fork failed {}", errno);
}
} }
return 0; return 0;

View File

@ -1333,7 +1333,6 @@ try
if (SessionLeader < 0) if (SessionLeader < 0)
{ {
Result = -1; Result = -1;
LOG_ERROR("fork failed for session leader {}", errno);
goto InitCreateSessionLeaderExit; goto InitCreateSessionLeaderExit;
} }

View File

@ -172,7 +172,7 @@ Return Value:
if (ChildPid < 0) if (ChildPid < 0)
{ {
LOG_ERROR("{} failed {}", CloneFlags ? "clone" : "fork", errno); LOG_ERROR("{} for {} failed {}", CloneFlags ? "clone" : "fork", ChildName, errno);
return -1; return -1;
} }
else if (ChildPid > 0) else if (ChildPid > 0)