Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/build/pkgs/atlas/patches/glibc_scanf_workaround.patch
8818 views
1
Bug in glibc-2.18: https://sourceware.org/bugzilla/show_bug.cgi?id=15917
2
3
4
--- a/tune/sysinfo/masrch.c
5
+++ b/tune/sysinfo/masrch.c
6
@@ -1,6 +1,7 @@
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <assert.h>
10
+#include <errno.h>
11
12
#ifndef NTIM
13
#define NTIM 3
14
@@ -113,7 +114,14 @@
15
j = 0;
16
for (i=0; i != NTIM; i++)
17
{
18
- assert( fscanf(fp, "%lf", &mflop[i]) );
19
+ /* FIXME: This assumes one float per line immediately followed by \n. */
20
+ char buf[100]; /* enough to read a double */
21
+ char *end;
22
+
23
+ assert(fgets(buf, sizeof buf, fp));
24
+ errno = 0;
25
+ mflop[i] = strtod(buf, &end);
26
+ assert(errno == 0 && end != buf && *end == '\n');
27
}
28
fclose(fp);
29
/*
30
31