aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-03-22 17:13:23 +0200
committerTimo Teräs <timo.teras@iki.fi>2016-03-22 17:13:23 +0200
commitaa2bbd1d7f85322bd838e9a71909416660189ae7 (patch)
tree2de740edc228f1e3fb4be21e20f794b206f77003 /main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
parentbdd2fccea55b6e7af9b2afd8ac5821d4d7ece65e (diff)
downloadaports-aa2bbd1d7f85322bd838e9a71909416660189ae7.tar.bz2
aports-aa2bbd1d7f85322bd838e9a71909416660189ae7.tar.xz
main/musl: upstream fix and gethostbyaddr_r fix
fixes #5282
Diffstat (limited to 'main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch')
-rw-r--r--main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch b/main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
new file mode 100644
index 0000000000..c80043e837
--- /dev/null
+++ b/main/musl/0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
@@ -0,0 +1,49 @@
+From 4aac019a0efd59011a48d031ad046c934c7e8365 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 16 Mar 2016 16:35:22 -0400
+Subject: [PATCH] fix padding string formats to width in wide printf variants
+
+the idiom fprintf(f, "%.*s", n, "") was wrongly used in vfwprintf as a
+means of producing n spaces; instead it produces no output. the
+correct form is fprintf(f, "%*s", n, ""), using width instead of
+precision, since for %s the later is a maximum rather than a minimum.
+---
+ src/stdio/vfwprintf.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
+index f06d5ae..f9f1ecf 100644
+--- a/src/stdio/vfwprintf.c
++++ b/src/stdio/vfwprintf.c
+@@ -288,9 +288,9 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
+ z = wmemchr(a, 0, p);
+ if (z) p=z-a;
+ if (w<p) w=p;
+- if (!(fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
++ if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
+ out(f, a, p);
+- if ((fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
++ if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
+ l=w;
+ continue;
+ case 'm':
+@@ -303,14 +303,14 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
+ if (i<0) return -1;
+ p=l;
+ if (w<p) w=p;
+- if (!(fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
++ if (!(fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
+ bs = arg.p;
+ while (l--) {
+ i=mbtowc(&wc, bs, MB_LEN_MAX);
+ bs+=i;
+ fputwc(wc, f);
+ }
+- if ((fl&LEFT_ADJ)) fprintf(f, "%.*s", w-p, "");
++ if ((fl&LEFT_ADJ)) fprintf(f, "%*s", w-p, "");
+ l=w;
+ continue;
+ }
+--
+2.7.4
+