Improve the error message when buffer size is too large to include
the maximum allowed size. This helps users understand what the actual
limit is rather than just reporting an invalid value.
Before: invalid buffer size argument: '...'
After: buffer size ... is too large (maximum is ...)
Signed-off-by: Karel Zak <kzak@redhat.com>
if (ctl.bufsize < 4096)
ctl.bufsize = 4096;
if (ctl.bufsize > SIZE_MAX - 8)
- errx(EXIT_FAILURE, "%s: '%s'",
- _("invalid buffer size argument"), optarg);
+ errx(EXIT_FAILURE,
+ _("buffer size %s is too large (maximum is %zu)"),
+ optarg, SIZE_MAX - 8);
break;
case 'T':
include_time_fmt(&ctl, DMESG_TIMEFTM_CTIME);