Skip to content

Commit c66fc5e

Browse files
committed
test_read.m4 silence compile warning set_but_not_used
1 parent 27c408b commit c66fc5e

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

test/nc_test/test_read.m4

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ TestFunc(open)(void)
140140
int err, ncid, ncid2, nok=0;
141141
ifdef(`PNETCDF', ``#'if 1', ``#'if 0')
142142
int fd;
143-
ssize_t w_len;
144143
#endif
145144

146145
/* Try to open a nonexistent file */
@@ -185,16 +184,10 @@ ifdef(`PNETCDF', ``#'if 1', ``#'if 0')
185184
error("Error: creating a non-CDF file (%s)", strerror(errno));
186185
}
187186
else {
187+
ssize_t w_len;
188188
w_len = write(fd, "0123456789abcdefghijklmnopqrstuvwxyz", 36);
189-
#ifdef NDEBUG
190-
if (w_len < 0) {
191-
fprintf(stderr, "Error %s at %d: write() (%s)",
192-
__func__,__LINE__,strerror(errno));
193-
abort();
194-
}
195-
#else
196-
assert(w_len >= 0);
197-
#endif
189+
if (w_len < 0)
190+
error("Error: writing to a non-CDF file (%s)", strerror(errno));
198191
close(fd);
199192
}
200193

0 commit comments

Comments
 (0)