gprofng: fix typos in get_realpath() and check_executable()
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Thu, 10 Aug 2023 02:18:58 +0000 (19:18 -0700)
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>
Sun, 13 Aug 2023 02:46:52 +0000 (19:46 -0700)
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
gprofng/src/checks.cc

index 8466064626391f00a72aebeb734bba71406e1916..07e93c46945710ca8e743b7bd812b0f6881e5355 100644 (file)
@@ -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)
index 4524611956d9b78673fa6b2a1ea5472583f54496..094c3bbc60a12eea1816f24c503b6b62a39ac47f 100644 (file)
@@ -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