Blob Blame History Raw

https://github.com/GrahamDumpleton/mod_wsgi/pull/364

https://bugzilla.redhat.com/show_bug.cgi?id=1602620

--- mod_wsgi-4.6.4/src/server/__init__.py.warnings
+++ mod_wsgi-4.6.4/src/server/__init__.py
@@ -103,7 +103,6 @@
     for name in mimetypes.knownfiles:
         if os.path.exists(name):
             return name
-            break
     else:
         return name
 
--- mod_wsgi-4.6.4/src/server/mod_wsgi.c.warnings
+++ mod_wsgi-4.6.4/src/server/mod_wsgi.c
@@ -2108,9 +2108,11 @@
     /* Publish event for the start of the response. */
 
     if (wsgi_event_subscribers()) {
+#if 0
         WSGIThreadInfo *thread_info;
 
         thread_info = wsgi_thread_info(0, 0);
+#endif
 
         event = PyDict_New();
 
@@ -6349,10 +6351,7 @@
 
         /* Need to cast const away. */
 
-        if (r)
-            id = &((request_rec *)r)->log_id;
-        else
-            id = &((conn_rec *)c)->log_id;
+        id = &((request_rec *)r)->log_id;
 
         ap_run_generate_log_id(c, r, id);
     }
@@ -8510,6 +8509,7 @@
         ap_log_error(APLOG_MARK, APLOG_ALERT, errno, wsgi_server,
                      "mod_wsgi (pid=%d): Couldn't bind unix domain "
                      "socket '%s'.", getpid(), process->socket_path);
+        close(sockfd);
         return -1;
     }
 
@@ -8521,6 +8521,7 @@
         ap_log_error(APLOG_MARK, APLOG_ALERT, errno, wsgi_server,
                      "mod_wsgi (pid=%d): Couldn't listen on unix domain "
                      "socket.", getpid());
+        close(sockfd);
         return -1;
     }
 
@@ -8555,6 +8556,7 @@
                          "mod_wsgi (pid=%d): Couldn't change owner of unix "
                          "domain socket '%s' to uid=%ld.", getpid(),
                          process->socket_path, (long)socket_uid);
+            close(sockfd);
             return -1;
         }
     }
@@ -13338,8 +13340,10 @@
         for (i = 0; i < wsgi_daemon_list->nelts; ++i) {
             entry = &entries[i];
 
-            close(entry->listener_fd);
-            entry->listener_fd = -1;
+            if (entry->listener_fd != -1) {
+                close(entry->listener_fd);
+                entry->listener_fd = -1;
+            }
         }
     }
 #endif
@@ -13751,8 +13755,8 @@
 
     if (trusted_proxy) {
         for (i=0; i<trusted_proxy_headers->nelts; i++) {
-            const char *name = NULL;
-            const char *value = NULL;
+            const char *name;
+            const char *value;
 
             name = ((const char**)trusted_proxy_headers->elts)[i];
             value = apr_table_get(r->subprocess_env, name);
@@ -13879,11 +13883,9 @@
          */
 
         for (i=0; i<trusted_proxy_headers->nelts; i++) {
-            const char *name = NULL;
-            const char *value = NULL;
+            const char *name;
 
             name = ((const char**)trusted_proxy_headers->elts)[i];
-            value = apr_table_get(r->subprocess_env, name);
 
             if (!strcmp(name, "HTTP_X_FORWARDED_FOR") ||
                      !strcmp(name, "HTTP_X_REAL_IP")) {
--- mod_wsgi-4.6.4/src/server/wsgi_logger.c.warnings
+++ mod_wsgi-4.6.4/src/server/wsgi_logger.c
@@ -694,9 +694,11 @@
             PyObject *object = NULL;
 
             if (wsgi_event_subscribers()) {
+#if 0
                 WSGIThreadInfo *thread_info;
 
                 thread_info = wsgi_thread_info(0, 0);
+#endif
 
                 event = PyDict_New();
 
--- mod_wsgi-4.6.4/src/server/wsgi_python.h.warnings
+++ mod_wsgi-4.6.4/src/server/wsgi_python.h
@@ -21,6 +21,12 @@
 
 /* ------------------------------------------------------------------------- */
 
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
 #include <Python.h>
 
 #if !defined(PY_VERSION_HEX)