aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/inet.c b/src/inet.c
index aefad27..571b838 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -175,7 +175,8 @@ int inet_meth_getpeername(lua_State *L, p_socket ps)
175 175
176 if (getpeername(*ps, p, &peer_len) < 0) { 176 if (getpeername(*ps, p, &peer_len) < 0) {
177 lua_pushnil(L); 177 lua_pushnil(L);
178 lua_pushstring(L, "getpeername failed"); 178 lua_pushfstring(L, "getpeername failed (%d): %s", errno,
179 strerror(errno));
179 } else { 180 } else {
180 char ipaddr[INET6_ADDRSTRLEN] = ""; 181 char ipaddr[INET6_ADDRSTRLEN] = "";
181 unsigned short port = 0; 182 unsigned short port = 0;
@@ -193,7 +194,7 @@ int inet_meth_getpeername(lua_State *L, p_socket ps)
193 break; 194 break;
194 default: 195 default:
195 lua_pushnil(L); 196 lua_pushnil(L);
196 lua_pushstring(L, "Unknown address family"); 197 lua_pushfstring(L, "Unknown address family %d", p->sa_family);
197 return 2; 198 return 2;
198 break; 199 break;
199 } 200 }