From ec85fadaabf35c53a3645e1568e094de1da16d09 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 17 Feb 2016 13:25:02 +0100 Subject: [PATCH] musl: add fputs patch. --- ...n-fputs-that-fwrite-returning-0-impl.patch | 34 +++++++++++++++++++ srcpkgs/musl/template | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/musl/patches/0001-fix-assumption-in-fputs-that-fwrite-returning-0-impl.patch diff --git a/srcpkgs/musl/patches/0001-fix-assumption-in-fputs-that-fwrite-returning-0-impl.patch b/srcpkgs/musl/patches/0001-fix-assumption-in-fputs-that-fwrite-returning-0-impl.patch new file mode 100644 index 0000000000..9bc907957c --- /dev/null +++ b/srcpkgs/musl/patches/0001-fix-assumption-in-fputs-that-fwrite-returning-0-impl.patch @@ -0,0 +1,34 @@ +From 10a17dfbad2c267d885817abc9c7589fc7ff630b Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Tue, 16 Feb 2016 13:26:16 -0500 +Subject: [PATCH] fix assumption in fputs that fwrite returning 0 implies an + error + +internally, the idiom of passing nmemb=1 to fwrite and interpreting +the return value of fwrite (which is necessarily 0 or 1) as +failure/success is fairly widely used. this is not correct, however, +when the size argument is unknown and may be zero, since C requires +fwrite to return 0 in that special case. previously fwrite always +returned nmemb on success, but this was changed for conformance with +ISO C by commit 500c6886c654fd45e4926990fee2c61d816be197. +--- + src/stdio/fputs.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/stdio/fputs.c b/src/stdio/fputs.c +index 4737f44..1cf344f 100644 +--- src/stdio/fputs.c ++++ src/stdio/fputs.c +@@ -3,7 +3,8 @@ + + int fputs(const char *restrict s, FILE *restrict f) + { +- return (int)fwrite(s, strlen(s), 1, f) - 1; ++ size_t l = strlen(s); ++ return (fwrite(s, 1, l, f)==l) - 1; + } + + weak_alias(fputs, fputs_unlocked); +-- +1.8.1.rc1 + diff --git a/srcpkgs/musl/template b/srcpkgs/musl/template index adb387026c..4081ff6478 100644 --- a/srcpkgs/musl/template +++ b/srcpkgs/musl/template @@ -1,7 +1,7 @@ # Template file for 'musl'. pkgname=musl version=1.1.13 -revision=1 +revision=2 build_style=gnu-configure configure_args="--prefix=/usr --disable-gcc-wrapper" conflicts="glibc>=0"