summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2020-05-29 11:17:56 +0000
committerdtucker <dtucker@openbsd.org>2020-05-29 11:17:56 +0000
commitc88bc58eac544526d5b3838f597cbabd95b53adf (patch)
treee1c065e0b80f736ba85ec607f404d83b98b9df77
parentPass a NULL instead of zeroed out va_list from dollar_expand. The original (diff)
downloadwireguard-openbsd-c88bc58eac544526d5b3838f597cbabd95b53adf.tar.xz
wireguard-openbsd-c88bc58eac544526d5b3838f597cbabd95b53adf.zip
Make dollar_expand variadic and pass a real va_list to vdollar_percent_expand.
Fixes build error on arm64 spotted by otto@.
-rw-r--r--usr.bin/ssh/misc.c15
-rw-r--r--usr.bin/ssh/misc.h4
2 files changed, 14 insertions, 5 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index e35420d60f4..ec869aea41b 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.151 2020/05/29 09:02:44 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.152 2020/05/29 11:17:56 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -1172,13 +1172,22 @@ vdollar_percent_expand(int *parseerror, int dollar, int percent,
#undef EXPAND_MAX_KEYS
}
+/*
+ * Expand only environment variables.
+ * Note that although this function is variadic like the other similar
+ * functions, any such arguments will be unused.
+ */
+
char *
-dollar_expand(int *parseerr, const char *string)
+dollar_expand(int *parseerr, const char *string, ...)
{
char *ret;
int err;
+ va_list ap;
- ret = vdollar_percent_expand(&err, 1, 0, string, NULL);
+ va_start(ap, string);
+ ret = vdollar_percent_expand(&err, 1, 0, string, ap);
+ va_end(ap);
if (parseerr != NULL)
*parseerr = err;
return ret;
diff --git a/usr.bin/ssh/misc.h b/usr.bin/ssh/misc.h
index 79e6ab50c1c..7e0af3ce434 100644
--- a/usr.bin/ssh/misc.h
+++ b/usr.bin/ssh/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.86 2020/05/29 04:25:40 dtucker Exp $ */
+/* $OpenBSD: misc.h,v 1.87 2020/05/29 11:17:56 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -69,7 +69,7 @@ long convtime(const char *);
const char *fmt_timeframe(time_t t);
char *tilde_expand_filename(const char *, uid_t);
-char *dollar_expand(int *, const char *string);
+char *dollar_expand(int *, const char *string, ...);
char *percent_expand(const char *, ...) __attribute__((__sentinel__));
char *percent_dollar_expand(const char *, ...) __attribute__((__sentinel__));
char *tohex(const void *, size_t);