Theoretically, getsockopt could fail and leave 'error' unset. While I
don't think this will happen in practice, the failure can be handled by
returning the value of errno.
committer: Frank Zschockelt <lm@freakysoft.de>
--- a/loudmouth/lm-sock.c Sat Oct 10 18:24:58 2009 +0200
+++ b/loudmouth/lm-sock.c Sat Oct 10 18:25:37 2009 +0200
@@ -208,7 +208,8 @@
void *error,
socklen_t *len)
{
- getsockopt (sock, SOL_SOCKET, SO_ERROR, (void*) error, len);
+ if (getsockopt (sock, SOL_SOCKET, SO_ERROR, (void*) error, len) != 0)
+ *((int *) error) = errno;
}
const gchar *