diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-20 01:58:38 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-07-20 01:58:38 +0000 |
commit | 016d58d18c14b04bb0707b9243747e384840794b (patch) | |
tree | 70271a6f07a2767c8e20339a0cda4ac655fc7e30 /regress/lib/libc | |
parent | 50f2ffb74940f66ab9571612b07c776869085dfa (diff) |
Fix ordering breakage, moving the fclose() test last again.
Also correct some format strings.
From Doug Hogan (doug (at) acyclic.org)
Diffstat (limited to 'regress/lib/libc')
-rw-r--r-- | regress/lib/libc/open_memstream/open_memstreamtest.c | 28 |
1 files changed, 22 insertions, 6 deletions
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 <mpi@openbsd.org> @@ -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); |