Kouhei Sutou
null+****@clear*****
Wed Jan 14 17:43:31 JST 2015
Kouhei Sutou 2015-01-14 17:43:31 +0900 (Wed, 14 Jan 2015) New Revision: d8bc605175e922a5a7e281e8735efdf237040afc https://github.com/groonga/groonga/commit/d8bc605175e922a5a7e281e8735efdf237040afc Message: Don't show errno for handled errno Modified files: lib/grn_ctx.h test/command/suite/ruby/load/nonexistent.expected Modified: lib/grn_ctx.h (+10 -2) =================================================================== --- lib/grn_ctx.h 2015-01-13 15:01:29 +0900 (789b436) +++ lib/grn_ctx.h 2015-01-14 17:43:31 +0900 (15c2930) @@ -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;\ @@ -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) Modified: test/command/suite/ruby/load/nonexistent.expected (+1 -1) =================================================================== --- test/command/suite/ruby/load/nonexistent.expected 2015-01-13 15:01:29 +0900 (27824ea) +++ test/command/suite/ruby/load/nonexistent.expected 2015-01-14 17:43:31 +0900 (691d28f) @@ -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) -------------- next part -------------- HTML����������������������������...Download