diff options
-rw-r--r-- | tests/basic/posix/zero-fill-enospace.c | 7 | ||||
-rw-r--r-- | tests/bugs/shard/bug-1696136.c | 5 | ||||
-rw-r--r-- | tests/bugs/shard/bug-shard-discard.c | 5 | ||||
-rw-r--r-- | tests/bugs/shard/shard-fallocate.c | 5 |
4 files changed, 13 insertions, 9 deletions
diff --git a/tests/basic/posix/zero-fill-enospace.c b/tests/basic/posix/zero-fill-enospace.c index 1371ff59a5f..b1f142c6be9 100644 --- a/tests/basic/posix/zero-fill-enospace.c +++ b/tests/basic/posix/zero-fill-enospace.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <stdlib.h> #include <glusterfs/api/glfs.h> #include <glusterfs/api/glfs-handles.h> @@ -8,7 +9,7 @@ main(int argc, char *argv[]) glfs_t *fs = NULL; glfs_fd_t *fd = NULL; int ret = 1; - int size = 0; + off_t size = 0; if (argc != 6) { fprintf(stderr, @@ -45,12 +46,12 @@ main(int argc, char *argv[]) goto out; } - size = atoi(argv[5]); + size = strtol(argv[5], NULL, 10); if (size < 0) { fprintf(stderr, "Wrong size %s", argv[5]); goto out; } - ret = glfs_zerofill(fd, 0, atoi(argv[5])); + ret = glfs_zerofill(fd, 0, size); if (ret <= 0) { fprintf(stderr, "glfs_zerofill: returned %d\n", ret); goto out; diff --git a/tests/bugs/shard/bug-1696136.c b/tests/bugs/shard/bug-1696136.c index b9e8d1375e5..cb650535b09 100644 --- a/tests/bugs/shard/bug-1696136.c +++ b/tests/bugs/shard/bug-1696136.c @@ -87,8 +87,9 @@ main(int argc, char *argv[]) goto out; } - offset = atoi(argv[4]); - len = atoi(argv[5]); + /* Note that off_t is signed but size_t isn't. */ + offset = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); fd = glfs_open(fs, argv[6], O_RDWR); if (fd == NULL) { diff --git a/tests/bugs/shard/bug-shard-discard.c b/tests/bugs/shard/bug-shard-discard.c index 15dca6c2181..6fa93fb89d1 100644 --- a/tests/bugs/shard/bug-shard-discard.c +++ b/tests/bugs/shard/bug-shard-discard.c @@ -50,8 +50,9 @@ main(int argc, char *argv[]) goto out; } - off = atoi(argv[4]); - len = atoi(argv[5]); + /* Note that off_t is signed but size_t isn't. */ + off = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); ret = glfs_discard(fd, off, len); if (ret <= 0) { diff --git a/tests/bugs/shard/shard-fallocate.c b/tests/bugs/shard/shard-fallocate.c index 45b9ce00509..cb0714e8564 100644 --- a/tests/bugs/shard/shard-fallocate.c +++ b/tests/bugs/shard/shard-fallocate.c @@ -87,8 +87,9 @@ main(int argc, char *argv[]) goto out; } - offset = atoi(argv[4]); - len = atoi(argv[5]); + /* Note that off_t is signed but size_t isn't. */ + offset = strtol(argv[4], NULL, 10); + len = strtoul(argv[5], NULL, 10); fd = glfs_open(fs, argv[6], O_RDWR); if (fd == NULL) { |