From 9d59bd6fc975c90785d667875d81c0879a37dd67 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] 0017-pidof: Get the arg1 base name with get_basename(). Same as program_base, cmd_arg0base, and exe_link_base. --- pidof.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pidof.c b/pidof.c index ad79c29a..4fa619a3 100644 --- a/pidof.c +++ b/pidof.c @@ -139,7 +139,6 @@ static void select_procs (void) static int size = 0; char *cmd_arg0, *cmd_arg0base; char *cmd_arg1, *cmd_arg1base; - char *pos; char *program_base; char *root_link; char *exe_link; @@ -198,12 +197,10 @@ static void select_procs (void) } else if (opt_scripts_too && *(p_cmdline+1)) { - pos = cmd_arg1base = cmd_arg1 = *(p_cmdline+1); + cmd_arg1 = *(p_cmdline+1); /* get the arg1 base name */ - while (*pos != '\0') { - if (*(pos++) == '/') cmd_arg1base = pos; - } + cmd_arg1base = get_basename(cmd_arg1); /* if script, then cmd = argv1, otherwise cmd = argv0 */ if (p_cmd &&