summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2016-12-09 11:29:32 +0100
committerLars Wendler <polynomial-c@gentoo.org>2016-12-09 11:29:32 +0100
commitf0325836449ab2b0ae4429fd34de2f9eb533fd23 (patch)
tree7cee2ba00e12b7e0043a44c5b80bd8131ffded8e /sys-process
parentapp-admin/sudo: Bump to version 1.8.19_beta2. Removed old, (diff)
downloadgentoo-f0325836449ab2b0ae4429fd34de2f9eb533fd23.tar.gz
gentoo-f0325836449ab2b0ae4429fd34de2f9eb533fd23.tar.bz2
gentoo-f0325836449ab2b0ae4429fd34de2f9eb533fd23.zip
sys-process/procps: Fix strtod_nol_err check for x86.
Package-Manager: portage-2.3.3
Diffstat (limited to 'sys-process')
-rw-r--r--sys-process/procps/files/procps-3.3.12-strtod_nol_err.patch110
-rw-r--r--sys-process/procps/procps-3.3.12.ebuild3
2 files changed, 113 insertions, 0 deletions
diff --git a/sys-process/procps/files/procps-3.3.12-strtod_nol_err.patch b/sys-process/procps/files/procps-3.3.12-strtod_nol_err.patch
new file mode 100644
index 000000000000..1a298c87f700
--- /dev/null
+++ b/sys-process/procps/files/procps-3.3.12-strtod_nol_err.patch
@@ -0,0 +1,110 @@
+From 4ed44ab58e27a9a09902b9c5b49df484842b6c9a Mon Sep 17 00:00:00 2001
+From: Dr. Werner Fink <werner@suse.de>
+Date: Wed, 13 Jul 2016 20:08:51 +1000
+Subject: [PATCH] misc: fix strtod_nol_err tests
+
+A better way of implementing the string to double
+conversion and a better way of testing it.
+
+Signed-off-by: Craig Small <csmall@enc.com.au>
+---
+diff --git a/include/strutils.h b/include/strutils.h
+index 85a6192..a5a15c9 100644
+--- a/include/strutils.h
++++ b/include/strutils.h
+@@ -7,6 +7,6 @@
+
+ extern long strtol_or_err(const char *str, const char *errmesg);
+ extern double strtod_or_err(const char *str, const char *errmesg);
+-double strtod_nol_or_err(char *str, const char *errmesg);
++extern double strtod_nol_or_err(char *str, const char *errmesg);
+
+ #endif
+diff --git a/lib/strutils.c b/lib/strutils.c
+index e5245db..e0632c4 100644
+--- a/lib/strutils.c
++++ b/lib/strutils.c
+@@ -20,6 +20,8 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
++#include <float.h>
++#include <math.h>
+ #include <stdlib.h>
+ #include <ctype.h>
+
+@@ -71,9 +73,9 @@ double strtod_or_err(const char *str, const char *errmesg)
+ */
+ double strtod_nol_or_err(char *str, const char *errmesg)
+ {
+- double num;
++ long double num;
+ const char *cp, *radix;
+- double mult;
++ long double mult;
+ int negative = 0;
+
+ if (str != NULL && *str != '\0') {
+@@ -95,29 +97,29 @@ double strtod_nol_or_err(char *str, const char *errmesg)
+ mult=0.1;
+ while(isdigit(*radix)) {
+ radix++;
+- mult *= 10;
++ mult *= 10.0;
+ }
+ while(isdigit(*cp)) {
+- num += (*cp - '0') * mult;
+- mult /= 10;
++ num += (long double)(*cp - '0') * mult;
++ mult /= 10.0;
+ cp++;
+ }
+ /* got the integers */
+ if (*cp == '\0')
+- return (negative?-num:num);
++ return (double)(negative?-num:num);
+ if (*cp != '.' && *cp != ',')
+ error(EXIT_FAILURE, EINVAL, "%s: '%s'", errmesg, str);
+
+ cp++;
+ mult = 0.1;
+ while(isdigit(*cp)) {
+- num += (*cp - '0') * mult;
+- mult /= 10;
++ num += (long double)(*cp - '0') * mult;
++ mult /= 10.0;
+ cp++;
+ }
+ if (*cp == '\0')
+- return (negative?-num:num);
++ return (double)(negative?-num:num);
+ }
+ error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
+- return 0;
++ return (double)0;
+ }
+diff --git a/lib/test_strtod_nol.c b/lib/test_strtod_nol.c
+index 0be798c..736768a 100644
+--- a/lib/test_strtod_nol.c
++++ b/lib/test_strtod_nol.c
+@@ -1,4 +1,5 @@
+-
++#include <float.h>
++#include <math.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include "strutils.h"
+@@ -33,8 +34,8 @@ int main(int argc, char *argv[])
+ double val;
+
+ for(i=0; tests[i].string != NULL; i++) {
+- if(strtod_nol_or_err(tests[i].string, "Cannot parse number") !=
+- tests[i].result) {
++ val = strtod_nol_or_err(tests[i].string, "Cannot parse number");
++ if(fabs(tests[i].result - val) > DBL_EPSILON) {
+ fprintf(stderr, "FAIL: strtod_nol_or_err(\"%s\") != %f\n",
+ tests[i].string, tests[i].result);
+ return EXIT_FAILURE;
+--
+libgit2 0.24.0
+
diff --git a/sys-process/procps/procps-3.3.12.ebuild b/sys-process/procps/procps-3.3.12.ebuild
index e0cf72cb4f03..412c5c8fb86b 100644
--- a/sys-process/procps/procps-3.3.12.ebuild
+++ b/sys-process/procps/procps-3.3.12.ebuild
@@ -35,6 +35,9 @@ S="${WORKDIR}/${PN}-ng-${PV}"
PATCHES=(
"${FILESDIR}"/${PN}-3.3.8-kill-neg-pid.patch # http://crbug.com/255209
"${FILESDIR}"/${PN}-3.3.11-sysctl-manpage.patch # 565304
+
+ # Upstream fixes
+ "${FILESDIR}"/${P}-strtod_nol_err.patch
)
src_prepare() {