Don't let users pass us -o fstrim_pct=NaN, because strtod will happily
return what looks like success but isn't actually a number. Codex found
this fun little nit.
Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: 34bed605490f93 ("xfs_scrub: tune fstrim minlen parameter based on free space histograms")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
#include <pthread.h>
#include <stdlib.h>
#include <paths.h>
+#include <math.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/statvfs.h>
errno = 0;
dval = strtod(val, &endp);
- if (*endp) {
+ if (*endp || isnan(dval)) {
fprintf(stderr,
_("-o fstrim_pct must be a floating point number\n"));
usage();