Skip to content

Commit

Permalink
ext/socket: add macro of rb_sys_fail_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Dec 14, 2011
1 parent 70b3d3f commit 9ef498a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/socket/socket.c
Expand Up @@ -410,9 +410,11 @@ bsock_setsockopt(VALUE sock, SEL sel, VALUE lev, VALUE optname, VALUE val)
break;
}

#define rb_sys_fail_path(path) rb_sys_fail(path == 0 ? NULL : RSTRING_PTR(path));

GetOpenFile(sock, fptr);
if (setsockopt(fptr->fd, level, option, v, vlen) < 0)
rb_sys_fail(fptr->path == 0 ? NULL : RSTRING_PTR(fptr->path));
rb_sys_fail_path(fptr->path);

return INT2FIX(0);
}
Expand Down Expand Up @@ -473,7 +475,7 @@ bsock_getsockopt(VALUE sock, SEL sel, VALUE lev, VALUE optname)

GetOpenFile(sock, fptr);
if (getsockopt(fptr->fd, level, option, buf, &len) < 0)
rb_sys_fail(fptr->path == 0 ? NULL : RSTRING_PTR(fptr->path));
rb_sys_fail_path(fptr->path);

return rb_str_new(buf, len);
#else
Expand Down

0 comments on commit 9ef498a

Please sign in to comment.