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>
Ben Hillis committed
Jun 13, 2025 at 14:20 UTC
1f0e66d25cb0b4bae3f3a42e1d58a339b23255fc
3 files changed
+10
-17
src/linux/init/config.cpp
+9
-15
@@ -1034,23 +1034,17 @@ try
1034
1035
if (Config.BootCommand.has_value())
1036
{
1037
- const int ChildPid =
1038
- UtilCreateChildProcess("BootCommand", [Command = Config.BootCommand.value(), SavedSignals = g_SavedSignalActions]() {
1039
- //
1040
- // Restore default signal dispositions for the child process.
1041
- //
1042
-
1043
- THROW_LAST_ERROR_IF(UtilSetSignalHandlers(SavedSignals, false) < 0);
1044
- THROW_LAST_ERROR_IF(UtilRestoreBlockedSignals() < 0);
1037
+ UtilCreateChildProcess("BootCommand", [Command = Config.BootCommand.value(), SavedSignals = g_SavedSignalActions]() {
1038
+ //
1039
+ // Restore default signal dispositions for the child process.
1040
+ //
1041
1046
- execl("/bin/sh", "sh", "-c", Command.c_str(), nullptr);
1047
- LOG_ERROR("execl() failed, {}", errno);
1048
- });
1042
+ THROW_LAST_ERROR_IF(UtilSetSignalHandlers(SavedSignals, false) < 0);
1043
+ THROW_LAST_ERROR_IF(UtilRestoreBlockedSignals() < 0);
1044
1050
- if (ChildPid < 0)
1051
- {
1052
- LOG_ERROR("fork failed {}", errno);
1053
- }
1045
+ execl("/bin/sh", "sh", "-c", Command.c_str(), nullptr);
1046
+ LOG_ERROR("execl() failed, {}", errno);
1047
+ });
1048
}
1049
1050
return 0;
src/linux/init/init.cpp
-1
@@ -1333,7 +1333,6 @@ try
1333
if (SessionLeader < 0)
1334
{
1335
Result = -1;
1336
- LOG_ERROR("fork failed for session leader {}", errno);
1336
goto InitCreateSessionLeaderExit;
1337
}
1338
src/linux/init/util.h
+1
-1
@@ -172,7 +172,7 @@ Return Value:
172
173
if (ChildPid < 0)
174
{
175
- LOG_ERROR("{} failed {}", CloneFlags ? "clone" : "fork", errno);
175
+ LOG_ERROR("{} for {} failed {}", CloneFlags ? "clone" : "fork", ChildName, errno);
176
return -1;
177
}
178
else if (ChildPid > 0)