The apr_is_option_set() stuff is only applicable to boolean settings. 
With other settings, there could be multiple calls with different
values.  (perhaps not practical, but still...)

Am I missing something here?
Index: network_io/unix/sockopt.c
===================================================================
--- network_io/unix/sockopt.c   (revision 169641)
+++ network_io/unix/sockopt.c   (working copy)
@@ -150,11 +150,8 @@
         break;
     case APR_SO_SNDBUF:
 #ifdef SO_SNDBUF
-        if (apr_is_option_set(sock, APR_SO_SNDBUF) != on) {
-            if (setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, (void 
*)&on, sizeof(int)) == -1) {
-                return errno;
-            }
-            apr_set_option(sock, APR_SO_SNDBUF, on);
+        if (setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, (void *)&on, 
sizeof(int)) == -1) {
+            return errno;
         }
 #else
         return APR_ENOTIMPL;
@@ -162,11 +159,8 @@
         break;
     case APR_SO_RCVBUF:
 #ifdef SO_RCVBUF
-        if (apr_is_option_set(sock, APR_SO_RCVBUF) != on) {
-            if (setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVBUF, (void 
*)&on, sizeof(int)) == -1) {
-                return errno;
-            }
-            apr_set_option(sock, APR_SO_RCVBUF, on);
+        if (setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVBUF, (void *)&on, 
sizeof(int)) == -1) {
+            return errno;
         }
 #else
         return APR_ENOTIMPL;
@@ -187,14 +181,13 @@
         break;
     case APR_SO_LINGER:
 #ifdef SO_LINGER
-        if (apr_is_option_set(sock, APR_SO_LINGER) != on) {
+        {
             struct linger li;
             li.l_onoff = on;
             li.l_linger = APR_MAX_SECS_TO_LINGER;
             if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, (char *) 
&li, sizeof(struct linger)) == -1) {
                 return errno;
             }
-            apr_set_option(sock, APR_SO_LINGER, on);
         }
 #else
         return APR_ENOTIMPL;

Reply via email to