/usr/include/x86_64-linux-gnu/bits/error.h:40:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
40 | __error_noreturn (__status, __errnum, __format, __va_arg_pack ());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pmap.c: In function ‘main’:
pmap.c:760:35: note: format string is defined here
760 | xerrx(EXIT_FAILURE, "%s: '%s'", _("failed to parse argument"), optarg);
A simple check for optarg being null silenced this, not sure why only
this one was a problem.
Signed-off-by: Craig Small <csmall@dropbear.xyz>
if ((buf = xstrdup(optarg)) == NULL) {
xerrx(EXIT_FAILURE, "%s: '%s'", _("failed to parse argument"),
- optarg);
+ (optarg?optarg:"(null)"));
}
arg1 = buf;
arg2 = strchr(arg1, ',');