From fbf8efefdec4db0d8211678db0cd274c0f8bcbe0 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Mon, 28 Apr 2008 21:16:51 +0000 Subject: [PATCH] Only truncate the programPath if it's followed by an EOL git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4847 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/exceptionhandler/dumpinfo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/exceptionhandler/dumpinfo.cpp b/lib/exceptionhandler/dumpinfo.cpp index 3cabae91c..907b7b3c7 100644 --- a/lib/exceptionhandler/dumpinfo.cpp +++ b/lib/exceptionhandler/dumpinfo.cpp @@ -84,7 +84,10 @@ static std::string getProgramPath(const char* programCommand) if (!programPath.empty()) { - programPath.erase(programPath.find('\n')); // `which' adds a \n which confuses exec() + // `which' adds a \n which confuses exec() + std::string::size_type eol = programPath.find('\n'); + if (eol != std::string::npos) + programPath.erase(eol); debug(LOG_WZ, "Found us at %s", programPath.c_str()); } else