From f014b0d6daf8cc02626d642d748f2c02718f82d7 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 24 Jul 2014 00:31:57 -0400 Subject: [PATCH] client: return a possible error code to the core client if execv fails for some reason in the switcher tool. --- client/switcher.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/switcher.cpp b/client/switcher.cpp index 7bc1aa84f0..3200ed62dc 100644 --- a/client/switcher.cpp +++ b/client/switcher.cpp @@ -130,9 +130,13 @@ int main(int /*argc*/, char** argv) { #endif } - execv(argv[1], argv+2); + retval = execv(argv[1], argv+2); + if (retval == -1) { + retval = errno; - // If we got here execv failed - fprintf(stderr, "Process creation (%s) failed: errno=%d\n", argv[1], errno); + // If we got here execv failed + fprintf(stderr, "Process creation (%s) failed: %s (errno = %d)\n", argv[1], strerror(retval), retval); + } + return retval; }