1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Description: clear errno before using it to check failure from atof()
The atof() function is not guaranteed to clear errno on success, so if
any earlier errors have been set prior to calling atof(), these will
result in a spurious failure. On armhf, glibc 2.31 now opportunistically
calls a new syscall that may not be supported on older kernels (Linux 4.15),
resulting in errno == ENOSYS:
.
syscall_0x193(0x5, 0xffb2b650, 0xf77b7000, 0, 0x5, 0xffb2b650) = -1 ENOSYS (Function not implemented)
.
Therefore we should clear errno before calling atof() to make sure any
errors actually originate from this function.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Last-Update: 2020-03-11
Bug-Debian: https://bugs.debian.org/953675
Index: clearcut-1.0.9/dmat.c
===================================================================
--- clearcut-1.0.9.orig/dmat.c
+++ clearcut-1.0.9/dmat.c
@@ -570,6 +570,7 @@
goto XIT_BAD;
}
+ errno = 0;
val = atof(token->buf);
if(errno) {
fprintf(stderr, "Clearcut: Distance value out-of-range.\n");
|