aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/getconf.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-07-30 09:59:37 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-07-30 10:00:58 +0300
commit48b16204aeeda5bc1f87e49c6b8e23d9abb07c73 (patch)
tree313c85bdff47e0192aaf540987237629649e245d /main/musl/getconf.c
parentf48523dcc064e0dca8e1c02845fc1fa8967bf794 (diff)
downloadaports-48b16204aeeda5bc1f87e49c6b8e23d9abb07c73.tar.bz2
aports-48b16204aeeda5bc1f87e49c6b8e23d9abb07c73.tar.xz
main/musl: fix getconf to print single values
It is not valid to use positional parameters without using them all. Otherwise the proper argument size cannot be determined. ref #3266
Diffstat (limited to 'main/musl/getconf.c')
-rw-r--r--main/musl/getconf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/main/musl/getconf.c b/main/musl/getconf.c
index 0c511c0855..c4235242b0 100644
--- a/main/musl/getconf.c
+++ b/main/musl/getconf.c
@@ -207,20 +207,20 @@ static void usage(const char *p)
static void print_long(const char *name, long val)
{
- static const char * const fmtstr[] = { "%2$ld\n", "%s = %ld\n" };
- printf(fmtstr[all], name, val);
+ if (all) printf("%s = %ld\n", name, val);
+ else printf("%ld\n", val);
}
static void print_ulong(const char *name, unsigned long val)
{
- static const char * const fmtstr[] = { "%2$lu\n", "%s = %lu\n" };
- printf(fmtstr[all], name, val);
+ if (all) printf("%s = %lu\n", name, val);
+ else printf("%lu\n", val);
}
static void print_string(const char *name, const char *val)
{
- static const char * const fmtstr[] = { "%2$s\n", "%s = %s\n" };
- printf(fmtstr[all], name, val);
+ if (all) printf("%s = %s\n", name, val);
+ else printf("%s\n", val);
}
static int print_constant(const struct conf_variable *cp, const char *pathname)