diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp index 4a7f9a15..ac8598f0 100644 --- a/src/Platform/Unix/Process.cpp +++ b/src/Platform/Unix/Process.cpp @@ -53,33 +53,13 @@ namespace VeraCrypt try { int argIndex = 0; - /* Workaround for gcc 5.X issue related to the use of STL (string and list) with muliple fork calls. - * - * The char* pointers retrieved from the elements of parameter "arguments" are no longer valid after - * a second fork is called. "arguments" was created in the parent of the current child process. - * - * The only solution is to copy the elements of "arguments" parameter in a local string array on this - * child process and then use char* pointers retrieved from this local copies before calling fork. - * - * gcc 4.x doesn't suffer from this issue. - * - */ - string argsCopy[array_capacity (args)]; if (!execFunctor) - { - argsCopy[argIndex++] = processName; - } + args[argIndex++] = const_cast (processName.c_str()); - foreach (const string &arg, arguments) + for (list::const_iterator it = arguments.begin(); it != arguments.end(); it++) { - argsCopy[argIndex++] = arg; + args[argIndex++] = const_cast (it->c_str()); } - - for (int i = 0; i < argIndex; i++) - { - args[i] = const_cast (argsCopy[i].c_str()); - } - args[argIndex] = nullptr; if (inputData)