mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-12-08 07:48:41 +00:00
Add warning message when MAX_FIELDS reached
Don't just silently drop.
This commit is contained in:
parent
f493dc3009
commit
f309d0ae43
@ -122,8 +122,13 @@ static int map_field_params(struct lnstat_file *lnstat_files,
|
|||||||
fps->params[j].print.width =
|
fps->params[j].print.width =
|
||||||
FIELD_WIDTH_DEFAULT;
|
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;
|
goto full;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
full:
|
full:
|
||||||
@ -272,8 +277,13 @@ int main(int argc, char **argv)
|
|||||||
for (tok = strtok(tmp, ",");
|
for (tok = strtok(tmp, ",");
|
||||||
tok;
|
tok;
|
||||||
tok = strtok(NULL, ",")) {
|
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;
|
break;
|
||||||
|
}
|
||||||
fp.params[fp.num++].name = tok;
|
fp.params[fp.num++].name = tok;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user