summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/raddrinfo.c4
-rw-r--r--ext/socket/socket.c4
-rw-r--r--ext/socket/unixsocket.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index 9212fc2bb52..bd4af345108 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -768,8 +768,8 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
StringValue(path);
if (sizeof(un.sun_path) <= (size_t)RSTRING_LEN(path))
- rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
- (int)sizeof(un.sun_path)-1);
+ rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)",
+ RSTRING_LEN(path), (int)sizeof(un.sun_path)-1);
MEMZERO(&un, struct sockaddr_un, 1);
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index d2177e505da..383bc2983eb 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1429,8 +1429,8 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path)
sockaddr.sun_family = AF_UNIX;
sun_path = StringValueCStr(path);
if (sizeof(sockaddr.sun_path) <= strlen(sun_path)) {
- rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
- (int)sizeof(sockaddr.sun_path)-1);
+ rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)",
+ RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path)-1);
}
strncpy(sockaddr.sun_path, sun_path, sizeof(sockaddr.sun_path)-1);
addr = rb_str_new((char*)&sockaddr, sizeof(sockaddr));
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index afa47d54f63..24721fbe3d9 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -40,8 +40,8 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
if (sizeof(sockaddr.sun_path) <= (size_t)RSTRING_LEN(path)) {
- rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
- (int)sizeof(sockaddr.sun_path)-1);
+ rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)",
+ RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path)-1);
}
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));