summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbluhm <>2019-05-13 02:54:54 +0000
committerbluhm <>2019-05-13 02:54:54 +0000
commit0cc84eb5bed9798e693521f96faaabfa193729c9 (patch)
treea37e37e361d04e03c929c3e857cedd3ea34f94cb /src
parent04e9acdb7805182f7e4b81d1fe4ae31dd77784eb (diff)
downloadopenbsd-0cc84eb5bed9798e693521f96faaabfa193729c9.tar.gz
openbsd-0cc84eb5bed9798e693521f96faaabfa193729c9.tar.bz2
openbsd-0cc84eb5bed9798e693521f96faaabfa193729c9.zip
The call to fseek(fp, -1, SEEK_END) also sets the reported size to
this value. To match the expectation of the test again, move this line before the the code that sets the final position. OK yasuoka@
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libc/open_memstream/open_memstreamtest.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/regress/lib/libc/open_memstream/open_memstreamtest.c b/src/regress/lib/libc/open_memstream/open_memstreamtest.c
index 5366a82ae9..e8da0e03b2 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.5 2019/05/02 08:38:41 yasuoka Exp $ */ 1/* $OpenBSD: open_memstreamtest.c,v 1.6 2019/05/13 02:54:54 bluhm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org> 4 * Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
@@ -138,33 +138,33 @@ main(void)
138 failures++; 138 failures++;
139 } 139 }
140 140
141 if (fseek(fp, 8, SEEK_SET) != 0) { 141 if (fseek(fp, -1, SEEK_END) != 0) {
142 warnx("failed to fseek. (19)"); 142 warnx("failed to fseek. (19)");
143 failures++; 143 failures++;
144 } 144 }
145 145
146 if (fseek(fp, 8, SEEK_SET) != 0) {
147 warnx("failed to fseek. (20)");
148 failures++;
149 }
150
146 if (ftell(fp) != 8) { 151 if (ftell(fp) != 8) {
147 warnx("failed seek test. (20)"); 152 warnx("failed seek test. (21)");
148 failures++; 153 failures++;
149 } 154 }
150 155
151 /* Try to seek backward */ 156 /* Try to seek backward */
152 if (fseek(fp, -1, SEEK_CUR) != 0) { 157 if (fseek(fp, -1, SEEK_CUR) != 0) {
153 warnx("failed to fseek. (21)"); 158 warnx("failed to fseek. (22)");
154 failures++; 159 failures++;
155 } 160 }
156 161
157 if (ftell(fp) != 7) { 162 if (ftell(fp) != 7) {
158 warnx("failed seeking backward. (22)"); 163 warnx("failed seeking backward. (23)");
159 failures++; 164 failures++;
160 } 165 }
161 166
162 if (fseek(fp, 5, SEEK_CUR) != 0) { 167 if (fseek(fp, 5, SEEK_CUR) != 0) {
163 warnx("failed to fseek. (23)");
164 failures++;
165 }
166
167 if (fseek(fp, -1, SEEK_END) != 0) {
168 warnx("failed to fseek. (24)"); 168 warnx("failed to fseek. (24)");
169 failures++; 169 failures++;
170 } 170 }