From 297bd429a9bc34c70832d60bedbf6db4e42616ea Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sat, 26 Jan 2013 21:18:55 +0100 Subject: [PATCH] core: check return of uwsgi_connect in uwsgi_opt_connect_and_read Reported by Coverity as CID #970995. --- core/uwsgi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/uwsgi.c b/core/uwsgi.c index dee67112..e3aa00eb 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -4035,7 +4035,7 @@ void uwsgi_opt_connect_and_read(char *opt, char *address, void *foobar) { char buf[8192]; int fd = uwsgi_connect(address, -1, 0); - for (;;) { + while (fd >= 0) { int ret = uwsgi_waitfd(fd, -1); if (ret <= 0) { exit(0); @@ -4046,6 +4046,8 @@ void uwsgi_opt_connect_and_read(char *opt, char *address, void *foobar) { } uwsgi_log("%.*s", (int) len, buf); } + uwsgi_error("uwsgi_connect()"); + exit(1); } void uwsgi_opt_extract(char *opt, char *address, void *foobar) {