From: Craig Small Date: Fri, 7 Jan 2022 20:47:46 +0000 (+1100) Subject: pmap: Fix minor compiler warning X-Git-Tag: v4.0.0~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b67402a25ea356b821fc7a1309dc781e43948fe;p=procps-ng pmap: Fix minor compiler warning /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 --- diff --git a/pmap.c b/pmap.c index 38b3629f..1e20fe0f 100644 --- a/pmap.c +++ b/pmap.c @@ -758,7 +758,7 @@ static void range_arguments(const char *optarg) if ((buf = xstrdup(optarg)) == NULL) { xerrx(EXIT_FAILURE, "%s: '%s'", _("failed to parse argument"), - optarg); + (optarg?optarg:"(null)")); } arg1 = buf; arg2 = strchr(arg1, ',');