summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-02 20:46:42 +0000
committermidipix <writeonce@midipix.org>2024-03-02 22:03:15 +0000
commit0b6090c468c5673029c718e0a4282df1146c17a2 (patch)
tree472f4fdf2bdf4417cb0dbc7f3e5252813d512fbc
parent39e52e63ebf9fd7572e57704cc27331a34a72a9a (diff)
downloadslibtool-0b6090c468c5673029c718e0a4282df1146c17a2.tar.bz2
slibtool-0b6090c468c5673029c718e0a4282df1146c17a2.tar.xz
slbt_obtain_nminfo(): properly handle nm(1) config-driven arguments.
-rw-r--r--src/arbits/slbt_archive_syminfo.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/arbits/slbt_archive_syminfo.c b/src/arbits/slbt_archive_syminfo.c
index 6dab61c..879278f 100644
--- a/src/arbits/slbt_archive_syminfo.c
+++ b/src/arbits/slbt_archive_syminfo.c
@@ -78,6 +78,7 @@ static int slbt_obtain_nminfo(
pid_t pid;
pid_t rpid;
int fdout;
+ char ** argv;
char arname [PATH_MAX];
char output [PATH_MAX];
char program[PATH_MAX];
@@ -85,10 +86,19 @@ static int slbt_obtain_nminfo(
/* fdcwd */
fdcwd = slbt_driver_fdcwd(dctx);
- /* program */
- if (slbt_snprintf(program,sizeof(program),
- "%s",dctx->cctx->host.nm) < 0)
- return SLBT_BUFFER_ERROR(dctx);
+ /* tool-specific argument vector */
+ argv = (slbt_get_driver_ictx(dctx))->host.nm_argv;
+
+ /* ar alternate argument vector */
+ if (argv) {
+ if (slbt_snprintf(program,sizeof(program),
+ "%s",argv[0]) < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+ } else {
+ if (slbt_snprintf(program,sizeof(program),
+ "%s",dctx->cctx->host.nm) < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+ }
/* output (.nm suffix, buf treat as .syminfo) */
pos = slbt_snprintf(