diff options
Diffstat (limited to 'tests/zfs-tests/cmd')
-rw-r--r-- | tests/zfs-tests/cmd/file_common.h | 8 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/file_trunc/file_trunc.c | 8 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/largest_file/largest_file.c | 4 | ||||
-rw-r--r-- | tests/zfs-tests/cmd/mmap_exec/mmap_exec.c | 11 |
4 files changed, 20 insertions, 11 deletions
diff --git a/tests/zfs-tests/cmd/file_common.h b/tests/zfs-tests/cmd/file_common.h index 759889e70..64b1777a9 100644 --- a/tests/zfs-tests/cmd/file_common.h +++ b/tests/zfs-tests/cmd/file_common.h @@ -37,6 +37,14 @@ extern "C" { #endif +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif + +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif + #include <sys/types.h> #include <sys/stat.h> #include <errno.h> diff --git a/tests/zfs-tests/cmd/file_trunc/file_trunc.c b/tests/zfs-tests/cmd/file_trunc/file_trunc.c index f9431300b..69096752e 100644 --- a/tests/zfs-tests/cmd/file_trunc/file_trunc.c +++ b/tests/zfs-tests/cmd/file_trunc/file_trunc.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include <stdio.h> @@ -87,11 +87,9 @@ main(int argc, char *argv[]) exit(3); } - while (i < count) { + for (i = 0; count == 0 || i < count; i++) { (void) do_write(fd); (void) do_trunc(fd); - - i++; } (void) close(fd); @@ -188,7 +186,7 @@ do_write(int fd) exit(5); } - strcpy(buf, "ZFS Test Suite Truncation Test"); + (void) strcpy(buf, "ZFS Test Suite Truncation Test"); if (write(fd, buf, bsize) < bsize) { perror("write"); exit(6); diff --git a/tests/zfs-tests/cmd/largest_file/largest_file.c b/tests/zfs-tests/cmd/largest_file/largest_file.c index 286232da5..5e6a18660 100644 --- a/tests/zfs-tests/cmd/largest_file/largest_file.c +++ b/tests/zfs-tests/cmd/largest_file/largest_file.c @@ -108,8 +108,8 @@ main(int argc, char **argv) write_ret = write(fd, mybuf, 1); if (write_ret < 0) { - if (errno == EFBIG) { - (void) printf("write errno=EFBIG: success\n"); + if (errno == EFBIG || errno == EINVAL) { + (void) printf("write errno=EFBIG|EINVAL: success\n"); err = 0; } else { err = errno; diff --git a/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c b/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c index 6a48a9c04..db90adbdc 100644 --- a/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c +++ b/tests/zfs-tests/cmd/mmap_exec/mmap_exec.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { - int fd; + int error, fd; struct stat statbuf; if (argc != 2) { @@ -51,18 +51,21 @@ main(int argc, char *argv[]) errno = 0; if ((fd = open(argv[1], O_RDONLY)) < 0) { + error = errno; perror("open"); - return (errno); + return (error); } if (fstat(fd, &statbuf) < 0) { + error = errno; perror("fstat"); - return (errno); + return (error); } if (mmap(0, statbuf.st_size, PROT_EXEC, MAP_SHARED, fd, 0) == MAP_FAILED) { + error = errno; perror("mmap"); - return (errno); + return (error); } return (0); |