From: guenther Date: Sun, 20 Jul 2014 01:58:37 +0000 (+0000) Subject: Fix ordering breakage, moving the fclose() test last again. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2b1dab59497fb4b02a94841e0ba855d4fa41bb26;p=openbsd Fix ordering breakage, moving the fclose() test last again. Also correct some format strings. From Doug Hogan (doug (at) acyclic.org) --- diff --git a/regress/lib/libc/open_memstream/open_memstreamtest.c b/regress/lib/libc/open_memstream/open_memstreamtest.c index a2327f21c50..0608bddeba4 100644 --- a/regress/lib/libc/open_memstream/open_memstreamtest.c +++ b/regress/lib/libc/open_memstream/open_memstreamtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open_memstreamtest.c,v 1.3 2013/03/28 09:35:58 mpi Exp $ */ +/* $OpenBSD: open_memstreamtest.c,v 1.4 2014/07/20 01:58:37 guenther Exp $ */ /* * Copyright (c) 2011 Martin Pieuchot @@ -78,7 +78,7 @@ main(void) } if (size != OFFSET + sizeof(hello)-1) { - warnx("failed, size %zu should be %u. (8)", + warnx("failed, size %zu should be %zu. (8)", size, OFFSET + sizeof(hello)-1); failures++; } @@ -99,7 +99,7 @@ main(void) } if (size != sizeof(start)-1) { - warnx("failed, size %zu should be %u. (12)", + warnx("failed, size %zu should be %zu. (12)", size, sizeof(start)-1); failures++; } @@ -127,13 +127,13 @@ main(void) failures++; } - if (fclose(fp) == EOF) { - warnx("fclose failed. (17)"); + if (fflush(fp) == EOF) { + warnx("fflush failed. (17)"); failures++; } if (size != OFFSET + sizeof(hello)-1) { - warnx("failed, size %zu should be %u. (18)", + warnx("failed, size %zu should be %zu. (18)", size, OFFSET + sizeof(hello)-1); failures++; } @@ -159,6 +159,22 @@ main(void) failures++; } + if (fseek(fp, 5, SEEK_CUR) != 0) { + warnx("failed to fseek. (23)"); + failures++; + } + + if (fclose(fp) == EOF) { + warnx("fclose failed. (24)"); + failures++; + } + + if (size != 12) { + warnx("failed, size %zu should be %u. (25)", + size, 12); + failures++; + } + free(buf); return (failures);