* [PATCH] gprofng: Use execvp instead of execv
@ 2023-08-16 2:51 vladimir.mezentsev
0 siblings, 0 replies; 2+ messages in thread
From: vladimir.mezentsev @ 2023-08-16 2:51 UTC (permalink / raw)
To: binutils; +Cc: Vladimir Mezentsev
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
I changed the commit message to explain the issue.
gp-display-gui (https://savannah.gnu.org/projects/gprofng-gui)
can be installed in a different directory.
In this case, $PATH is used to look up gp-display-text.
execv() does not use $PATH to find the executable.
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(-)
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);
}
/**
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] gprofng: Use execvp instead of execv
@ 2023-08-15 19:49 vladimir.mezentsev
0 siblings, 0 replies; 2+ messages in thread
From: vladimir.mezentsev @ 2023-08-15 19:49 UTC (permalink / raw)
To: binutils; +Cc: Vladimir Mezentsev
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(-)
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);
}
/**
--
2.31.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-16 2:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 2:51 [PATCH] gprofng: Use execvp instead of execv vladimir.mezentsev
-- strict thread matches above, loose matches on Subject: below --
2023-08-15 19:49 vladimir.mezentsev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).