Skip to content

Commit

Permalink
internal.h: rb_syserr_fail_path
Browse files Browse the repository at this point in the history
* 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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Oct 20, 2013
1 parent 52231de commit c6b9f29
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Sun Oct 20 15:29:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>

* 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 <nobu@ruby-lang.org>

* include/ruby/ruby.h (rb_obj_wb_unprotect, rb_obj_written),
Expand Down
9 changes: 8 additions & 1 deletion error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) : "";
Expand Down
3 changes: 3 additions & 0 deletions internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit c6b9f29

Please sign in to comment.