mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-12-08 09:07:22 +00:00
Add warning message when MAX_FIELDS reached
Don't just silently drop.
This commit is contained in:
parent
f493dc3009
commit
f309d0ae43
@ -122,10 +122,15 @@ static int map_field_params(struct lnstat_file *lnstat_files,
|
||||
fps->params[j].print.width =
|
||||
FIELD_WIDTH_DEFAULT;
|
||||
|
||||
if (++j >= MAX_FIELDS - 1)
|
||||
if (++j >= MAX_FIELDS - 1) {
|
||||
fprintf(stderr,
|
||||
"WARN: MAX_FIELDS (%d) reached,"
|
||||
" truncating number of keys\n",
|
||||
MAX_FIELDS);
|
||||
goto full;
|
||||
}
|
||||
}
|
||||
}
|
||||
full:
|
||||
fps->num = j;
|
||||
return 1;
|
||||
@ -272,8 +277,13 @@ int main(int argc, char **argv)
|
||||
for (tok = strtok(tmp, ",");
|
||||
tok;
|
||||
tok = strtok(NULL, ",")) {
|
||||
if (fp.num >= MAX_FIELDS)
|
||||
if (fp.num >= MAX_FIELDS) {
|
||||
fprintf(stderr,
|
||||
"WARN: too many keys"
|
||||
" requested: (%d max)\n",
|
||||
MAX_FIELDS);
|
||||
break;
|
||||
}
|
||||
fp.params[fp.num++].name = tok;
|
||||
}
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user