Bug in glibc-2.18: https://sourceware.org/bugzilla/show_bug.cgi?id=15917
--- a/tune/sysinfo/masrch.c
+++ b/tune/sysinfo/masrch.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <errno.h>
#ifndef NTIM
#define NTIM 3
@@ -113,7 +114,14 @@
j = 0;
for (i=0; i != NTIM; i++)
{
- assert( fscanf(fp, "%lf", &mflop[i]) );
+ /* FIXME: This assumes one float per line immediately followed by \n. */
+ char buf[100]; /* enough to read a double */
+ char *end;
+
+ assert(fgets(buf, sizeof buf, fp));
+ errno = 0;
+ mflop[i] = strtod(buf, &end);
+ assert(errno == 0 && end != buf && *end == '\n');
}
fclose(fp);
/*