From 0b6090c468c5673029c718e0a4282df1146c17a2 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 2 Mar 2024 20:46:42 +0000 Subject: slbt_obtain_nminfo(): properly handle nm(1) config-driven arguments. --- src/arbits/slbt_archive_syminfo.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/arbits') 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( -- cgit v1.2.3