From 51afd4adfe9bf0b0f2e29bd6a1c149d74b7e86f0 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 2 Aug 2016 14:20:46 +0200 Subject: [PATCH] ltlcross: prefer execl("/bin/sh", ...) to execlp("sh", ...) Fixes #98. * bin/common_trans.cc: Here. --- bin/common_trans.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/common_trans.cc b/bin/common_trans.cc index 46b3d532a..64c9230c2 100644 --- a/bin/common_trans.cc +++ b/bin/common_trans.cc @@ -560,6 +560,12 @@ exec_command(const char* cmd) return; } use_shell: + // Try /bin/sh first, because it is faster to not do any PATH + // lookup. + static bool has_bin_sh = true; + if (has_bin_sh) + execl("/bin/sh", "sh", "-c", start, nullptr); + has_bin_sh = false; execlp("sh", "sh", "-c", start, nullptr); error(2, errno, "failed to run 'sh'"); SPOT_UNREACHABLE();