diff options
author | guenther <> | 2014-07-20 01:58:37 +0000 |
---|---|---|
committer | guenther <> | 2014-07-20 01:58:37 +0000 |
commit | ce35eeccb92f21894ebe7ad98b1e207c576034ab (patch) | |
tree | 6aa95f8643da28c5ff818b9a902039bd027574cd /src | |
parent | de21c6ec21e1a745fd5d9c4878218fb4d07f0737 (diff) | |
download | openbsd-ce35eeccb92f21894ebe7ad98b1e207c576034ab.tar.gz openbsd-ce35eeccb92f21894ebe7ad98b1e207c576034ab.tar.bz2 openbsd-ce35eeccb92f21894ebe7ad98b1e207c576034ab.zip |
Fix ordering breakage, moving the fclose() test last again.
Also correct some format strings.
From Doug Hogan (doug (at) acyclic.org)
Diffstat (limited to 'src')
-rw-r--r-- | src/regress/lib/libc/open_memstream/open_memstreamtest.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/regress/lib/libc/open_memstream/open_memstreamtest.c b/src/regress/lib/libc/open_memstream/open_memstreamtest.c index a2327f21c5..0608bddeba 100644 --- a/src/regress/lib/libc/open_memstream/open_memstreamtest.c +++ b/src/regress/lib/libc/open_memstream/open_memstreamtest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: open_memstreamtest.c,v 1.3 2013/03/28 09:35:58 mpi Exp $ */ | 1 | /* $OpenBSD: open_memstreamtest.c,v 1.4 2014/07/20 01:58:37 guenther Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> | 4 | * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> |
@@ -78,7 +78,7 @@ main(void) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | if (size != OFFSET + sizeof(hello)-1) { | 80 | if (size != OFFSET + sizeof(hello)-1) { |
81 | warnx("failed, size %zu should be %u. (8)", | 81 | warnx("failed, size %zu should be %zu. (8)", |
82 | size, OFFSET + sizeof(hello)-1); | 82 | size, OFFSET + sizeof(hello)-1); |
83 | failures++; | 83 | failures++; |
84 | } | 84 | } |
@@ -99,7 +99,7 @@ main(void) | |||
99 | } | 99 | } |
100 | 100 | ||
101 | if (size != sizeof(start)-1) { | 101 | if (size != sizeof(start)-1) { |
102 | warnx("failed, size %zu should be %u. (12)", | 102 | warnx("failed, size %zu should be %zu. (12)", |
103 | size, sizeof(start)-1); | 103 | size, sizeof(start)-1); |
104 | failures++; | 104 | failures++; |
105 | } | 105 | } |
@@ -127,13 +127,13 @@ main(void) | |||
127 | failures++; | 127 | failures++; |
128 | } | 128 | } |
129 | 129 | ||
130 | if (fclose(fp) == EOF) { | 130 | if (fflush(fp) == EOF) { |
131 | warnx("fclose failed. (17)"); | 131 | warnx("fflush failed. (17)"); |
132 | failures++; | 132 | failures++; |
133 | } | 133 | } |
134 | 134 | ||
135 | if (size != OFFSET + sizeof(hello)-1) { | 135 | if (size != OFFSET + sizeof(hello)-1) { |
136 | warnx("failed, size %zu should be %u. (18)", | 136 | warnx("failed, size %zu should be %zu. (18)", |
137 | size, OFFSET + sizeof(hello)-1); | 137 | size, OFFSET + sizeof(hello)-1); |
138 | failures++; | 138 | failures++; |
139 | } | 139 | } |
@@ -159,6 +159,22 @@ main(void) | |||
159 | failures++; | 159 | failures++; |
160 | } | 160 | } |
161 | 161 | ||
162 | if (fseek(fp, 5, SEEK_CUR) != 0) { | ||
163 | warnx("failed to fseek. (23)"); | ||
164 | failures++; | ||
165 | } | ||
166 | |||
167 | if (fclose(fp) == EOF) { | ||
168 | warnx("fclose failed. (24)"); | ||
169 | failures++; | ||
170 | } | ||
171 | |||
172 | if (size != 12) { | ||
173 | warnx("failed, size %zu should be %u. (25)", | ||
174 | size, 12); | ||
175 | failures++; | ||
176 | } | ||
177 | |||
162 | free(buf); | 178 | free(buf); |
163 | 179 | ||
164 | return (failures); | 180 | return (failures); |