summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e339797)
They were being ignored. Exit on failure; harsh, but we don't know the
circumstances where they might occur and thus what recovery would be
apt.
if (!s->track_filepos)
return;
if (!s->track_filepos)
return;
+ if ((pos = ftello(iob)) == -1)
+ adios("getfld's iob", "failed to get offset on entry");
if (pos == 0 && s->last_internal_pos == 0)
return;
if (pos == 0 && s->last_internal_pos == 0)
return;
s->total_bytes_read += pos_movement;
pos = s->last_internal_pos;
} else {
s->total_bytes_read += pos_movement;
pos = s->last_internal_pos;
} else {
size_t num_read;
/* This seek skips past an integral number of
chunks of size MSG_INPUT_SIZE. */
size_t num_read;
/* This seek skips past an integral number of
chunks of size MSG_INPUT_SIZE. */
- fseeko (iob, pos/MSG_INPUT_SIZE * MSG_INPUT_SIZE, SEEK_SET);
+ off = pos / MSG_INPUT_SIZE * MSG_INPUT_SIZE;
+ if (fseeko(iob, off, SEEK_SET) == -1)
+ adios("getfld's iob", "failed to set offset to skip: %d",
+ off);
num_read = fread (s->msg_buf, 1, MSG_INPUT_SIZE, iob);
s->readpos = s->msg_buf + pos % MSG_INPUT_SIZE;
s->end = s->msg_buf + num_read;
num_read = fread (s->msg_buf, 1, MSG_INPUT_SIZE, iob);
s->readpos = s->msg_buf + pos % MSG_INPUT_SIZE;
s->end = s->msg_buf + num_read;
- fseeko (iob, pos, SEEK_SET);
+ if (fseeko(iob, pos, SEEK_SET) == -1)
+ adios("getfld's iob", "failed to set offset on entry: %d", pos);
if (s->track_filepos) {
/* Save the internal file position that we use for the input buffer. */
if (s->track_filepos) {
/* Save the internal file position that we use for the input buffer. */
- s->last_internal_pos = ftello (s->iob);
+ if ((s->last_internal_pos = ftello(s->iob)) == -1)
+ adios("getfld's iob", "failed to get offset before seek");
/* Set file stream position so that callers can use ftell(). */
/* Set file stream position so that callers can use ftell(). */
- fseeko (s->iob, s->total_bytes_read, SEEK_SET);
- s->last_caller_pos = ftello (s->iob);
+ if (fseeko(s->iob, s->total_bytes_read, SEEK_SET) == -1)
+ adios("getfld's iob", "failed to set offset: %d",
+ s->total_bytes_read);
+ if ((s->last_caller_pos = ftello(s->iob)) == -1)
+ adios("getfld's iob", "failed to get offset after seek");