Skip to content

Commit

Permalink
Do not silently ignore seek errors
Browse files Browse the repository at this point in the history
Makes issues we might have easier to spot
  • Loading branch information
spiiroin committed Nov 8, 2012
1 parent da37f2e commit 0d14b5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mce-io.c
Expand Up @@ -681,6 +681,10 @@ static gboolean io_string_cb(GIOChannel *source,
if (iomon->rewind == TRUE) {
g_io_channel_seek_position(source, 0, G_SEEK_SET, &error);

if( error ) {
mce_log(LL_ERR, "%s: seek error: %s",
iomon->file, error->message);
}
/* Reset errno,
* to avoid false positives down the line
*/
Expand Down Expand Up @@ -758,6 +762,10 @@ static gboolean io_chunk_cb(GIOChannel *source,
/* Seek to the beginning of the file before reading if needed */
if (iomon->rewind == TRUE) {
g_io_channel_seek_position(source, 0, G_SEEK_SET, &error);
if( error ) {
mce_log(LL_ERR, "%s: seek error: %s",
iomon->file, error->message);
}

/* Reset errno,
* to avoid false positives down the line
Expand Down Expand Up @@ -830,6 +838,10 @@ static gboolean io_chunk_cb(GIOChannel *source,
g_clear_error(&error);
g_io_channel_seek_position(iomon->iochan, 0,
G_SEEK_END, &error);
if( error ) {
mce_log(LL_ERR, "%s: seek error: %s",
iomon->file, error->message);
}
} else {
status = FALSE;
}
Expand Down Expand Up @@ -1001,6 +1013,10 @@ void mce_resume_io_monitor(gconstpointer io_monitor)
G_IO_FLAG_IS_SEEKABLE) == G_IO_FLAG_IS_SEEKABLE)) {
g_io_channel_seek_position(iomon->iochan, 0,
G_SEEK_END, &error);
if( error ) {
mce_log(LL_ERR, "%s: seek error: %s",
iomon->file, error->message);
}
/* Reset errno,
* to avoid false positives down the line
*/
Expand Down

0 comments on commit 0d14b5b

Please sign in to comment.