[PATCH] libxcmd: return error from cvtnum() on overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Test 071 was failing in weird ways, partly because it was trying
to pass in offsets larger than strtoll() could accept, which then
silently returned LLONG_MAX instead.  For DIO tests, this was
unaligned, so we got unexpected (to me, anyay) alignment errors.

At least printing out the perror() makes this more obvious,
but unfortunately we then get the somewhat odd output:

# xfs_io -f -d -c "pwrite 9223373136366403584  4096" /mnt/test/grrr
cvtnum: Numerical result out of range
non-numeric offset argument -- 9223373136366403584

Test 071 still fails, but at least it's a bit more obvious as to why.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---

Note:
... should I change all callsites from "non-numeric" to "invalid" perhaps?

diff --git a/libxcmd/input.c b/libxcmd/input.c
index d7f29c1..6d4c003 100644
--- a/libxcmd/input.c
+++ b/libxcmd/input.c
@@ -153,6 +153,10 @@ cvtnum(
 	int		c;
 
 	i = strtoll(s, &sp, 0);
+	if (errno == ERANGE) {
+		perror("cvtnum");
+		return -1LL;
+	}
 	if (i == 0 && sp == s)
 		return -1LL;
 	if (*sp == '\0')

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux