diff --git a/ChangeLog b/ChangeLog index 1b3751d9ca..168c89f85f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Oct 20 15:29:05 2013 Nobuyoshi Nakada + + * error.c (rb_syserr_fail_path_in): new function split from + rb_sys_fail_path_in to raise SystemCallError without errno. + + * internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without + errno. + Sun Oct 20 13:58:47 2013 Nobuyoshi Nakada * include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written), diff --git a/error.c b/error.c index ec2ad350f1..c8d51c101d 100644 --- a/error.c +++ b/error.c @@ -1967,9 +1967,16 @@ void rb_sys_fail_path_in(const char *func_name, VALUE path) { int n = errno; - VALUE args[2]; errno = 0; + rb_syserr_fail_path_in(func_name, n, path); +} + +void +rb_syserr_fail_path_in(const char *func_name, int n, VALUE path) +{ + VALUE args[2]; + if (!path) path = Qnil; if (n == 0) { const char *s = !NIL_P(path) ? RSTRING_PTR(path) : ""; diff --git a/internal.h b/internal.h index f207f0e3cc..8135306dd6 100644 --- a/internal.h +++ b/internal.h @@ -413,12 +413,15 @@ void Init_File(void); # pragma GCC visibility push(default) # endif NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path)); +NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path)); # if defined __GNUC__ && __GNUC__ >= 4 # pragma GCC visibility pop # endif # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path) +# define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path)) #else # define rb_sys_fail_path(path) rb_sys_fail_str(path) +# define rb_syserr_fail_path(err, path) rb_sys_fail_str((err), (path)) #endif /* gc.c */