related: fix inconsistencies in result type references

This patch is a response to errors found in those type
references now that our library allows for validation.

In two cases, former assignments to a result structure
could no longer employ that VAL macro if validation is
active. Thus, direct reference to some stack was used.

For the record, those instances were to be found here:
. ps - uses PIDS_extra to store the cooked pcpu values
. top - uses PIDS_extra to store the forest view level

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2016-08-05 00:00:00 -05:00
committed by Craig Small
parent e3270d463d
commit 105058ae2d
4 changed files with 17 additions and 12 deletions

6
w.c
View File

@@ -344,6 +344,7 @@ static int find_best_proc(
char *cmdline)
{
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i], info)
#define PIDS_GETUNT(e) PIDS_VAL(EU_ ## e, u_int, reap->stacks[i], info)
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, reap->stacks[i], info)
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i], info)
unsigned uid = ~0U;
@@ -413,8 +414,8 @@ static int find_best_proc(
}
}
if (
(!ignoreuser && uid != PIDS_GETINT(EUID)
&& uid != PIDS_GETINT(RUID))
(!ignoreuser && uid != PIDS_GETUNT(EUID)
&& uid != PIDS_GETUNT(RUID))
|| (PIDS_GETINT(PGRP) != PIDS_GETINT(TPGID))
|| (PIDS_GETULL(START) <= best_time)
)
@@ -426,6 +427,7 @@ static int find_best_proc(
procps_pids_unref(&info);
return found_utpid;
#undef PIDS_GETINT
#undef PIDS_GETUNT
#undef PIDS_GETULL
#undef PIDS_GETSTR
}