public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: vladimir.mezentsev@oracle.com
To: binutils@sourceware.org
Cc: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Subject: [PATCH 1/2] gprofng: fix typos in get_realpath() and check_executable()
Date: Thu, 10 Aug 2023 11:48:28 -0700	[thread overview]
Message-ID: <20230810184828.3014191-1-vladimir.mezentsev@oracle.com> (raw)

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

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

	* src/Application.cc (Application::get_realpath): Fix typo.
	* src/checks.cc (collect::check_executable): Likewise.
---
 gprofng/src/Application.cc | 3 ++-
 gprofng/src/checks.cc      | 9 ++-------
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gprofng/src/Application.cc b/gprofng/src/Application.cc
index 84660646263..07e93c46945 100644
--- a/gprofng/src/Application.cc
+++ b/gprofng/src/Application.cc
@@ -100,7 +100,8 @@ Application::get_realpath (const char *_name)
 	    {
 	      if (path != s)
 		{
-		  char *nm = dbe_sprintf (NTXT ("%.*s/%s"), (int) (path - s - 1), path, _name);
+		  char *nm = dbe_sprintf (NTXT ("%.*s/%s"), (int) (s - path),
+				   path, _name);
 		  exe_name = realpath (nm, NULL);
 		  free (nm);
 		  if (exe_name)
diff --git a/gprofng/src/checks.cc b/gprofng/src/checks.cc
index 4524611956d..094c3bbc60a 100644
--- a/gprofng/src/checks.cc
+++ b/gprofng/src/checks.cc
@@ -261,7 +261,7 @@ collect::check_executable (char *target_name)
     {
       // not found, look on path
       char *exe_name = get_realpath (target_name);
-      if (access (exe_name, X_OK) == 0)
+      if (access (exe_name, X_OK) != 0)
 	{
 	  // target can't be located
 	  // one last attempt: append .class to name, and see if we can find it
@@ -293,13 +293,8 @@ collect::check_executable (char *target_name)
     return EXEC_OK;
   // do not by pass checking architectural match
   collect::Exec_status exec_stat = check_executable_arch (elf);
-  if (exec_stat != EXEC_OK)
-    {
-      delete elf;
-      return exec_stat;
-    }
   delete elf;
-  return EXEC_OK;
+  return exec_stat;
 }
 
 collect::Exec_status
-- 
2.31.1


                 reply	other threads:[~2023-08-10 18:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230810184828.3014191-1-vladimir.mezentsev@oracle.com \
    --to=vladimir.mezentsev@oracle.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).