]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
quota: fix generic/244 on 32-bit platforms
authorTheodore Ts'o <tytso@mit.edu>
Mon, 4 Jul 2016 14:09:48 +0000 (10:09 -0400)
committerEryu Guan <eguan@redhat.com>
Tue, 5 Jul 2016 07:03:06 +0000 (15:03 +0800)
commit76eb2b1f6e57e3bb4ab3019528d4c87b2317b060
treea02d15cdd782a57383720d2fbbb9e5b03fd44d92
parent5bde2583c38ce401b4cff81c182dcd49985dbe22
quota: fix generic/244 on 32-bit platforms

The test program src/test-nextquota.c relies on atoi() to convert a
string to an *unsigned* int.  If the string represents an integer
which is greater than INT_MAX, it is undefined how atoi(3) works,
and it turns out that:

       uint id = atoi("2147483649");

results in id == 2147483649 on x86_64, and id == 2147483647 on a
32-bit x86 platform.

So use strtoul(3) instead, which is portable and technically correct

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
src/test-nextquota.c