Print this page
15291 zfs-tests errno flaws exposed by 15220

*** 22,31 **** --- 22,35 ---- /* * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + /* + * Copyright 2022 MNX Cloud, Inc. + */ + #include "../file_common.h" #include <libgen.h> static unsigned char bigbuffer[BIGBUFFERSIZE];
*** 57,66 **** --- 61,71 ---- char *operation = NULL; offset_t noffset, offset = 0; int verbose = 0; int rsync = 0; int wsync = 0; + int exitcode; /* * Process Arguments */ while ((c = getopt(argc, argv, "b:c:d:s:f:o:vwr")) != -1) {
*** 164,182 **** /* * Given an operation (create/overwrite/append), open the file * accordingly and perform a write of the appropriate type. */ if ((bigfd = open(filename, oflag, 0666)) == -1) { (void) printf("open %s: failed [%s]%d. Aborting!\n", filename, strerror(errno), errno); ! exit(errno); } noffset = llseek(bigfd, offset, SEEK_SET); if (noffset != offset) { (void) printf("llseek %s (%lld/%lld) failed [%s]%d.Aborting!\n", filename, offset, noffset, strerror(errno), errno); ! exit(errno); } if (verbose) { (void) printf("%s: block_size = %d, write_count = %d, " "offset = %lld, data = %s%d\n", filename, block_size, --- 169,189 ---- /* * Given an operation (create/overwrite/append), open the file * accordingly and perform a write of the appropriate type. */ if ((bigfd = open(filename, oflag, 0666)) == -1) { + exitcode = errno; (void) printf("open %s: failed [%s]%d. Aborting!\n", filename, strerror(errno), errno); ! exit(exitcode); } noffset = llseek(bigfd, offset, SEEK_SET); if (noffset != offset) { + exitcode = errno; (void) printf("llseek %s (%lld/%lld) failed [%s]%d.Aborting!\n", filename, offset, noffset, strerror(errno), errno); ! exit(exitcode); } if (verbose) { (void) printf("%s: block_size = %d, write_count = %d, " "offset = %lld, data = %s%d\n", filename, block_size,
*** 187,201 **** for (i = 0; i < write_count; i++) { ssize_t n; if ((n = write(bigfd, &bigbuffer, block_size)) == -1) { (void) printf("write failed (%ld), good_writes = %lld, " "error: %s[%d]\n", (long)n, good_writes, strerror(errno), errno); ! exit(errno); } good_writes++; } if (verbose) { --- 194,209 ---- for (i = 0; i < write_count; i++) { ssize_t n; if ((n = write(bigfd, &bigbuffer, block_size)) == -1) { + exitcode = errno; (void) printf("write failed (%ld), good_writes = %lld, " "error: %s[%d]\n", (long)n, good_writes, strerror(errno), errno); ! exit(exitcode); } good_writes++; } if (verbose) {