Navigation Menu

Skip to content

Commit

Permalink
Show more information on lseek() error
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 16, 2015
1 parent efa79d5 commit 8c04bb9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/grn.h
Expand Up @@ -458,12 +458,14 @@ typedef int grn_cond;
# else /* WIN64 */
# define GRN_FMT_SOCKET "u"
# endif /* WIN64 */
# define GRN_FMT_OFF_T GRN_FMT_LLD
#else /* WIN32 */
# define GRN_FMT_LLD "lld"
# define GRN_FMT_LLU "llu"
# define GRN_FMT_SIZE "zu"
# define GRN_FMT_SSIZE "zd"
# define GRN_FMT_SOCKET "d"
# define GRN_FMT_OFF_T "jd"
#endif /* WIN32 */

#ifdef __GNUC__
Expand Down
14 changes: 11 additions & 3 deletions lib/ii.c
Expand Up @@ -7401,9 +7401,17 @@ grn_ii_buffer_fetch(grn_ctx *ctx, grn_ii_buffer *ii_buffer,
return;
}
}
if (grn_lseek(ii_buffer->tmpfd, block->head, SEEK_SET) != block->head) {
ERRNO_ERR("grn_lseek");
return;
{
off_t seeked_position;
seeked_position = grn_lseek(ii_buffer->tmpfd, block->head, SEEK_SET);
if (seeked_position != block->head) {
ERRNO_ERR("grn_lseek");
GRN_LOG(ctx, GRN_LOG_ERROR,
"failed to grn_lseek(%" GRN_FMT_OFF_T ") -> %" GRN_FMT_OFF_T,
block->head,
seeked_position);
return;
}
}
if (grn_read(ii_buffer->tmpfd, block->buffer, bytesize) != bytesize) {
SERR("read");
Expand Down

0 comments on commit 8c04bb9

Please sign in to comment.