Navigation Menu

Skip to content

Commit

Permalink
Fix error report about open()
Browse files Browse the repository at this point in the history
open() sets errno.
  • Loading branch information
kou committed Apr 18, 2015
1 parent 9513a61 commit 20ee392
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ii.c
Expand Up @@ -7799,7 +7799,7 @@ grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
ii_buffer->tmpfd = GRN_OPEN(ii_buffer->tmpfpath, O_RDONLY);
#endif /* WIN32 */
if (ii_buffer->tmpfd == -1) {
SERR("oepn");
ERRNO_ERR("oepn");
return ctx->rc;
}
{
Expand Down
7 changes: 5 additions & 2 deletions lib/io.c
Expand Up @@ -495,7 +495,7 @@ grn_io_detect_type(grn_ctx *ctx, const char *path)
}
grn_close(fd);
} else {
SERR(path);
ERRNO_ERR(path);
}
return res;
}
Expand All @@ -513,7 +513,10 @@ grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)
{
struct _grn_io_header h;
int fd = GRN_OPEN(path, O_RDWR | O_BINARY);
if (fd == -1) { SERR(path); return NULL; }
if (fd == -1) {
ERRNO_ERR(path);
return NULL;
}
if (fstat(fd, &s) != -1 && s.st_size >= sizeof(struct _grn_io_header)) {
if (grn_read(fd, &h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {
if (!memcmp(h.idstr, GRN_IO_IDSTR, 16)) {
Expand Down

0 comments on commit 20ee392

Please sign in to comment.