diff --git a/src/appsession.c b/src/appsession.c index 1d442ca2f..ec97336e3 100644 --- a/src/appsession.c +++ b/src/appsession.c @@ -103,7 +103,7 @@ static struct task *appsession_refresh(struct task *t) */ len = sprintf(trash, "appsession_refresh: cleaning up expired Session '%s' on Server %s\n", element->sessid, element->serverid?element->serverid:"(null)"); - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } /* delete the expired element from within the hash table */ LIST_DEL(&element->hash_list); diff --git a/src/frontend.c b/src/frontend.c index 12f55ad2b..e5d847bc9 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -181,7 +181,7 @@ int frontend_accept(struct session *s) break; } - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } if (s->fe->mode == PR_MODE_HTTP) diff --git a/src/haproxy.c b/src/haproxy.c index d0ea71318..fdc6acc13 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -1292,14 +1292,13 @@ int main(int argc, char **argv) /* chroot if needed */ if (global.chroot != NULL) { - if (chroot(global.chroot) == -1) { + if (chroot(global.chroot) == -1 || chdir("/") == -1) { Alert("[%s.main()] Cannot chroot(%s).\n", argv[0], global.chroot); if (nb_oldpids) tell_old_pids(SIGTTIN); protocol_unbind_all(); exit(1); } - chdir("/"); } if (nb_oldpids) diff --git a/src/proto_http.c b/src/proto_http.c index 22623c058..88226d19a 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -7347,7 +7347,7 @@ void debug_hdr(const char *dir, struct session *t, const char *start, const char UBOUND(max, sizeof(trash) - len - 1); len += strlcpy2(trash + len, start, max + 1); trash[len++] = '\n'; - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } /* diff --git a/src/session.c b/src/session.c index e814903aa..017ac2672 100644 --- a/src/session.c +++ b/src/session.c @@ -2063,7 +2063,7 @@ struct task *process_session(struct task *t) s->uniq_id, s->be->id, (unsigned short)s->si[0].fd, (unsigned short)s->si[1].fd); - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } if (s->si[0].state == SI_ST_CLO && @@ -2072,7 +2072,7 @@ struct task *process_session(struct task *t) s->uniq_id, s->be->id, (unsigned short)s->si[0].fd, (unsigned short)s->si[1].fd); - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } } @@ -2179,7 +2179,7 @@ struct task *process_session(struct task *t) len = sprintf(trash, "%08x:%s.closed[%04x:%04x]\n", s->uniq_id, s->be->id, (unsigned short)s->req->prod->fd, (unsigned short)s->req->cons->fd); - write(1, trash, len); + if (write(1, trash, len) < 0) /* shut gcc warning */; } s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);