Navigation Menu

Skip to content

Commit

Permalink
Don't show errno for handled errno
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 14, 2015
1 parent 8c6d7a4 commit d8bc605
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/grn_ctx.h
Expand Up @@ -338,6 +338,7 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
#define SERR(str) do {\
grn_rc rc;\
int errno_keep = errno;\
grn_bool show_errno = GRN_FALSE;\
switch (errno_keep) {\
case ELOOP : rc = GRN_TOO_MANY_SYMBOLIC_LINKS; break;\
case ENAMETOOLONG : rc = GRN_FILENAME_TOO_LONG; break;\
Expand Down Expand Up @@ -384,9 +385,16 @@ GRN_API void grn_ctx_impl_set_current_error_message(grn_ctx *ctx);
case ETIMEDOUT : rc = GRN_OPERATION_TIMEOUT; break;\
case ECONNREFUSED: rc = GRN_CONNECTION_REFUSED; break;\
case EAGAIN: rc = GRN_OPERATION_WOULD_BLOCK; break;\
default : rc = GRN_UNKNOWN_ERROR; break;\
default :\
rc = GRN_UNKNOWN_ERROR;\
show_errno = GRN_TRUE;\
break;\
}\
if (show_errno) {\
ERR(rc, "syscall error '%s' (%s)[%d]", str, strerror(errno_keep), errno_keep);\
} else {\
ERR(rc, "syscall error '%s' (%s)", str, strerror(errno_keep));\
}\
ERR(rc, "syscall error '%s' (%s)[%d]", str, strerror(errno_keep), errno_keep);\
} while (0)

#define SOERR(str) SERR(str)
Expand Down
2 changes: 1 addition & 1 deletion test/command/suite/ruby/load/nonexistent.expected
Expand Up @@ -16,4 +16,4 @@ ruby_load "nonexistent.rb"
}
}
]
#|e| syscall error 'fopen: failed to open mruby script file: <nonexistent.rb>' (No such file or directory)[?]
#|e| syscall error 'fopen: failed to open mruby script file: <nonexistent.rb>' (No such file or directory)

0 comments on commit d8bc605

Please sign in to comment.