]> granicus.if.org Git - apache/commitdiff
Merge r1703248, r1827366 from trunk:
authorYann Ylavic <ylavic@apache.org>
Tue, 29 May 2018 21:19:30 +0000 (21:19 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 29 May 2018 21:19:30 +0000 (21:19 +0000)
core: Avoid a compiler warning when NO_LINGCLOSE is used (-Wunreachable-code).
Also, check c->aborted before apr_socket_shutdown() because it is set earlier,
and there is no point in calling shutdown() before close().

mod_ldap: fix format warnings.

Submitted by: ylavic
Reviewed by: jailletc36, jim, ylavic

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1832491 13f79535-47bb-0310-9956-ffa450edef68

modules/ldap/util_ldap_cache.c
modules/ldap/util_ldap_cache_mgr.c
server/connection.c

index 7698ffe1ef61ef4067e7f64bcc00508a47ec753b..774a76e1acfd05acf990e9e1b552c63272c96796 100644 (file)
@@ -113,7 +113,7 @@ void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n
                    "<td nowrap>%ld</td>"
                    "<td nowrap>%ld</td>"
                    "<td nowrap>%ld</td>"
-                   "<td nowrap>%ld</td>"
+                   "<td nowrap>%" APR_TIME_T_FMT "</td>"
                    "<td nowrap>%ld</td>"
                    "<td nowrap>%s</td>"
                    "</tr>",
@@ -122,7 +122,7 @@ void util_ldap_url_node_display(request_rec *r, util_ald_cache_t *cache, void *n
                    cache_node->size,
                    cache_node->maxentries,
                    cache_node->numentries,
-                   cache_node->ttl / APR_USEC_PER_SEC,
+                   apr_time_sec(cache_node->ttl),
                    cache_node->fullmark,
                    date_str);
     }
index c551a226d8293356bfbb362c04bc2de4f4f39475..9bef3f88b4e33b2debc74eea687176d66162943b 100644 (file)
@@ -741,7 +741,7 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st)
                                "</tr>\n"
                                "<tr>\n"
                                "<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>TTL (sec):</b></font></td>"
-                               "<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%ld</b></font></td>"
+                               "<td bgcolor='#ffffff'><font size='-1' face='Arial,Helvetica' color='#000000'><b>%" APR_TIME_T_FMT "</b></font></td>"
                                "</tr>\n"
                                "<tr>\n"
                                "<td bgcolor='#000000'><font size='-1' face='Arial,Helvetica' color='#ffffff'><b>Full Mark:</b></font></td>"
@@ -755,7 +755,7 @@ char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st)
                                util_ldap_cache->size,
                                util_ldap_cache->maxentries,
                                util_ldap_cache->numentries,
-                               util_ldap_cache->ttl / APR_USEC_PER_SEC,
+                               apr_time_sec(util_ldap_cache->ttl),
                                util_ldap_cache->fullmark,
                                date_str);
 
index 917e661c4fb89d651f0a4323b870f205eeab3e56..19745376db8a1e363949b854c77c133b2e8755cf 100644 (file)
@@ -130,12 +130,6 @@ AP_DECLARE(int) ap_start_lingering_close(conn_rec *c)
         return 1;
     }
     
-#ifdef NO_LINGCLOSE
-    ap_flush_conn(c); /* just close it */
-    apr_socket_close(csd);
-    return 1;
-#endif
-
     /* Close the connection, being careful to send out whatever is still
      * in our buffers.  If possible, try to avoid a hard close until the
      * client has ACKed our FIN and/or has stopped sending us data.
@@ -144,21 +138,20 @@ AP_DECLARE(int) ap_start_lingering_close(conn_rec *c)
     /* Send any leftover data to the client, but never try to again */
     ap_flush_conn(c);
 
-    if (c->aborted) {
-        apr_socket_close(csd);
-        return 1;
-    }
-
+#ifdef NO_LINGCLOSE
+    apr_socket_close(csd);
+    return 1;
+#else
     /* Shut down the socket for write, which will send a FIN
      * to the peer.
      */
-    if (apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS
-        || c->aborted) {
+    if (c->aborted
+            || apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS) {
         apr_socket_close(csd);
         return 1;
     }
-
     return 0;
+#endif
 }
 
 AP_DECLARE(void) ap_lingering_close(conn_rec *c)