library: if the VAL type is wrong still return a value
Rather than return a 0 result for all VAL type errors, return what would have been without validation active. This will enable a program like pgrep to still print a result even though it used some incorrect type member. With this commit, our VAL macro validations logic will behave in exactly the same way as the GET validations. While warning messages may be issued, except for a bad enumerator, values will always be returned to callers. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
c0f33884b5
commit
7d20df9ef0
@ -1036,7 +1036,6 @@ PROCPS_EXPORT struct diskstats_result *xtra_diskstats_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_diskstats_val
|
||||
|
@ -908,7 +908,6 @@ PROCPS_EXPORT struct meminfo_result *xtra_meminfo_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_meminfo_val
|
||||
|
@ -1525,7 +1525,6 @@ PROCPS_EXPORT struct pids_result *xtra_pids_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_pids_val
|
||||
|
@ -1065,7 +1065,6 @@ PROCPS_EXPORT struct slabinfo_result *xtra_slabinfo_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_slabinfo_val
|
||||
|
@ -1183,7 +1183,6 @@ PROCPS_EXPORT struct stat_result *xtra_stat_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_stat_val
|
||||
|
@ -1304,7 +1304,6 @@ PROCPS_EXPORT struct vmstat_result *xtra_vmstat_val (
|
||||
if (str[0]
|
||||
&& (strcmp(typestr, str))) {
|
||||
fprintf(stderr, "%s line %d: was %s, expected %s\n", file, lineno, typestr, str);
|
||||
return NULL;
|
||||
}
|
||||
return &stack->head[relative_enum];
|
||||
} // end: xtra_vmstat_val
|
||||
|
Loading…
Reference in New Issue
Block a user