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 07:04:05 +0000
commitfad5f035469b68ae40a4c0e8edad5e15d3f515bf (patch)
treeaaa34f4caffb719b5e70532f083398eda8531ae9 /main/musl/getconf.c
parent6638da15f64ee1d8204301ff1bd6ecd66427d1b9 (diff)
downloadaports-fad5f035469b68ae40a4c0e8edad5e15d3f515bf.tar.bz2
aports-fad5f035469b68ae40a4c0e8edad5e15d3f515bf.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. fixes #3266 (cherry picked from commit 48b16204aeeda5bc1f87e49c6b8e23d9abb07c73)
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)