gprofng: Use execvp instead of execv

Message ID 20230815194941.540603-1-vladimir.mezentsev@oracle.com
State New
Headers
Series gprofng: Use execvp instead of execv |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_check--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 warning Patch is already merged

Commit Message

Vladimir Mezentsev Aug. 15, 2023, 7:49 p.m. UTC
  From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

gprofng/ChangeLog
2023-08-15  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/gp-display-text.cc (reexec): Use execvp instead of execv.
---
 gprofng/src/gp-display-text.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gprofng/src/gp-display-text.cc b/gprofng/src/gp-display-text.cc
index 0d0a5e75e44..85ae274fc63 100644
--- a/gprofng/src/gp-display-text.cc
+++ b/gprofng/src/gp-display-text.cc
@@ -20,6 +20,7 @@ 
 
 #include "config.h"
 #include <unistd.h>     // isatty
+#include <errno.h>
 
 #include "gp-print.h"
 #include "ipcio.h"
@@ -55,7 +56,11 @@  reexec ()
 {
   if (dbeSession != NULL)
     dbeSession->unlink_tmp_files ();
-  execv (exe_name, new_argv);
+  execvp (exe_name, new_argv);
+  fprintf (stderr, GTXT ("Error: reexec() failed (%d: %s)\n"), errno,
+	   STR(strerror (errno)));
+  fflush (stderr);
+  exit (1);
 }
 
 /**