From c8864e801090a998122662600f84f0530c120e0b Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 28 Jun 2020 00:00:00 -0500 Subject: [PATCH] misc: eliminate a couple of miscellaneous gcc warnings This commit just address the two warnings shown below. Reference(s): pgrep.c: In function `select_procs': pgrep.c:535:12: warning: variable `now' set but not used [-Wunused-but-set-variable] 535 | time_t now; | ^~~ pidof.c: In function `select_procs': pidof.c:201:9: warning: `stat_cmd' may be used uninitialized in this function [-Wmaybe-uninitialized] 201 | !strcmp(program, stat_cmd) || | ^~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jim Warner --- pgrep.c | 2 -- pidof.c | 4 ---- 2 files changed, 6 deletions(-) diff --git a/pgrep.c b/pgrep.c index a55f49f0..d753cc91 100644 --- a/pgrep.c +++ b/pgrep.c @@ -529,12 +529,10 @@ static struct el * select_procs (int *num) char *cmdoutput = xmalloc(cmdlen); char *task_cmdline; enum pids_fetch_type which; - time_t now; double uptime_secs; preg = do_regcomp(); - now = time(NULL); if (procps_uptime(&uptime_secs, NULL) < 0) xerrx(EXIT_FAILURE, "uptime"); diff --git a/pidof.c b/pidof.c index 92456a0f..87a08584 100644 --- a/pidof.c +++ b/pidof.c @@ -145,7 +145,6 @@ static void select_procs (void) static int size = 0; char *cmd_arg0, *cmd_arg0base; char *cmd_arg1, *cmd_arg1base; - char *stat_cmd; char *program_base; char *root_link; char *exe_link; @@ -196,9 +195,6 @@ static void select_procs (void) if (!strcmp(program, cmd_arg0base) || !strcmp(program_base, cmd_arg0) || !strcmp(program, cmd_arg0) || - - !strcmp(program, stat_cmd) || - !strcmp(program, exe_link_base) || !strcmp(program, exe_link)) {