diff --git a/plugins/fastrouter/fastrouter.c b/plugins/fastrouter/fastrouter.c index de65f720..934179f1 100644 --- a/plugins/fastrouter/fastrouter.c +++ b/plugins/fastrouter/fastrouter.c @@ -321,7 +321,7 @@ void fastrouter_loop() { cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA (cmsg)) = fr_session->fd; + memcpy(CMSG_DATA(cmsg), &fr_session->fd, sizeof(int)); if (sendmsg(fr_session->instance_fd, &msg, 0) < 0) { uwsgi_error("sendmsg()"); diff --git a/plugins/http/http.c b/plugins/http/http.c index f0bff0a4..3402322a 100644 --- a/plugins/http/http.c +++ b/plugins/http/http.c @@ -532,7 +532,7 @@ void http_loop() { cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA (cmsg)) = uhttp_session->fd; + memcpy(CMSG_DATA(cmsg), &uhttp_session->fd, sizeof(int)); if (sendmsg(uhttp_session->instance_fd, &msg, 0) < 0) { uwsgi_error("sendmsg()"); diff --git a/protocol.c b/protocol.c index d1c62536..14afc9aa 100644 --- a/protocol.c +++ b/protocol.c @@ -170,7 +170,7 @@ ssize_t uwsgi_send_message(int fd, uint8_t modifier1, uint8_t modifier2, char *m cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA (cmsg)) = pfd; + memcpy(CMSG_DATA(cmsg), &pfd, sizeof(int)); uwsgi_log("passing fd\n"); cnt = sendmsg(fd, &msg, 0); @@ -355,7 +355,7 @@ int uwsgi_parse_response(struct pollfd *upoll, int timeout, struct uwsgi_header // upgrade connection to the new socket uwsgi_log("upgrading fd %d to ", upoll->fd); close(upoll->fd); - upoll->fd = *((int *) CMSG_DATA (cmsg)); + memcpy(CMSG_DATA(cmsg), &upoll->fd, sizeof(int)); uwsgi_log("%d\n", upoll->fd); cmsg = CMSG_NXTHDR (&msg, cmsg); } diff --git a/tests/threads.py b/tests/threads.py index 9affc026..9c623c3a 100644 --- a/tests/threads.py +++ b/tests/threads.py @@ -6,22 +6,22 @@ import sys def monitor1(): while 1: time.sleep(1) - print "i am the monitor 1" + print("i am the monitor 1") def monitor2(): while 1: time.sleep(2) - print "i am the monitor 2" - print sys.modules + print("i am the monitor 2") + print(sys.modules) def monitor3(): while 1: time.sleep(5) - print "5 seconds elapsed" + print("5 seconds elapsed") #reload(fake) def spawn_my_magic_threads(): - print "^^^ spawning magic threads ^^^" + print("^^^ spawning magic threads ^^^") t = threading.Thread(target=monitor1).start() t2 = threading.Thread(target=monitor2).start() t3 = threading.Thread(target=monitor3).start() diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 121ba5e4..b9318b48 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -333,8 +333,8 @@ class uConf(object): self.cflags.append("-DUWSGI_UDP") if self.get('pcre'): - if self.get('pcre') == 'auto': - pcreconf = spcall('pcre-config --libs') + if self.get('pcre') == 'auto': + pcreconf = spcall('pcre-config --libs') if pcreconf: self.libs.append(pcreconf) pcreconf = spcall("pcre-config --cflags") @@ -342,9 +342,9 @@ class uConf(object): self.gcc_list.append('regexp') self.cflags.append("-DUWSGI_PCRE") - else: - pcreconf = spcall('pcre-config --libs') - if pcreconf is None: + else: + pcreconf = spcall('pcre-config --libs') + if pcreconf is None: print("*** libpcre headers unavailable. uWSGI build is interrupted. You have to install pcre development package or disable pcre") sys.exit(1) else: