summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocesslauncher.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-01-17 18:55:42 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-01-17 18:55:42 -0500
commitc0731c1c05cafe508c91c5f583301234ba3b8403 (patch)
tree90710d025b74ff4873f681bfb4a06dea8c28d67b /indra/llcommon/llprocesslauncher.cpp
parenta01dd3549cca620de47fae824198473c51a12f49 (diff)
Add log message if LLProcessLauncher child fails to execv().
On a Posix platform (vfork()/execv() implementation), if for any reason the execv() failed (e.g. executable not on PATH), the viewer would never know, nor the user: the vfork() child produced no output, and terminated with rc 0! Add logging, make child terminate with nonzero rc. Remove pointless addArgument(const char*) overload: this does nothing for you that the compiler won't do implicitly. In llupdateinstaller.cpp, remove pointless c_str() call in addArgument() arg: we were starting with a std::string, then extracting its c_str(), only to construct a whole new std::string from it!
Diffstat (limited to 'indra/llcommon/llprocesslauncher.cpp')
-rw-r--r--indra/llcommon/llprocesslauncher.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/indra/llcommon/llprocesslauncher.cpp b/indra/llcommon/llprocesslauncher.cpp
index 10950181fd..25d64e9e28 100644
--- a/indra/llcommon/llprocesslauncher.cpp
+++ b/indra/llcommon/llprocesslauncher.cpp
@@ -73,11 +73,6 @@ void LLProcessLauncher::addArgument(const std::string &arg)
mLaunchArguments.push_back(arg);
}
-void LLProcessLauncher::addArgument(const char *arg)
-{
- mLaunchArguments.push_back(std::string(arg));
-}
-
#if LL_WINDOWS
int LLProcessLauncher::launch(void)
@@ -262,12 +257,19 @@ int LLProcessLauncher::launch(void)
if(id == 0)
{
// child process
-
::execv(mExecutable.c_str(), (char * const *)fake_argv);
-
+
// If we reach this point, the exec failed.
- // Use _exit() instead of exit() per the vfork man page.
- _exit(0);
+ LL_WARNS("LLProcessLauncher") << "failed to launch: ";
+ for (const char * const * ai = fake_argv; *ai; ++ai)
+ {
+ LL_CONT << *ai << ' ';
+ }
+ LL_CONT << LL_ENDL;
+ // Use _exit() instead of exit() per the vfork man page. Exit with a
+ // distinctive rc: someday soon we'll be able to retrieve it, and it
+ // would be nice to be able to tell that the child process failed!
+ _exit(249);
}
// parent process