diff options
Diffstat (limited to 'src/options.c')
| -rw-r--r-- | src/options.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c index 6cae7ee..6f36ba4 100644 --- a/src/options.c +++ b/src/options.c | |||
| @@ -254,6 +254,19 @@ static int opt_getboolean(lua_State *L, p_socket ps, int level, int name) | |||
| 254 | return 1; | 254 | return 1; |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | int opt_get_error(lua_State *L, p_socket ps) | ||
| 258 | { | ||
| 259 | int val = 0; | ||
| 260 | socklen_t len = sizeof(val); | ||
| 261 | if (getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *) &val, &len) < 0) { | ||
| 262 | lua_pushnil(L); | ||
| 263 | lua_pushstring(L, "getsockopt failed"); | ||
| 264 | return 2; | ||
| 265 | } | ||
| 266 | lua_pushstring(L, socket_strerror(val)); | ||
| 267 | return 1; | ||
| 268 | } | ||
| 269 | |||
| 257 | static int opt_setboolean(lua_State *L, p_socket ps, int level, int name) | 270 | static int opt_setboolean(lua_State *L, p_socket ps, int level, int name) |
| 258 | { | 271 | { |
| 259 | int val = auxiliar_checkboolean(L, 3); /* obj, name, bool */ | 272 | int val = auxiliar_checkboolean(L, 3); /* obj, name, bool */ |
