summaryrefslogtreecommitdiff
path: root/source4/web_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-18 12:19:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:32 -0500
commitb60ef4ee096d471992aac806fb67485ee26d657f (patch)
tree94d63f9b79d28a2875c5bb82c9da682b85b1efcb /source4/web_server
parent71f34f401e2864a7ee37e9d664eaa398aa1081f4 (diff)
downloadsamba-b60ef4ee096d471992aac806fb67485ee26d657f.tar.gz
samba-b60ef4ee096d471992aac806fb67485ee26d657f.tar.bz2
samba-b60ef4ee096d471992aac806fb67485ee26d657f.zip
r9389: handle errors reading from files in web server
bug found by coverity (This used to be commit 1a3229777adf12f8148267af7b33689ebe880ed8)
Diffstat (limited to 'source4/web_server')
-rw-r--r--source4/web_server/web_server.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c
index 80e479d8a7..4962185526 100644
--- a/source4/web_server/web_server.c
+++ b/source4/web_server/web_server.c
@@ -153,13 +153,14 @@ static void websrv_send(struct stream_connection *conn, uint16_t flags)
web->output.nsent = 0;
nread = read(web->output.fd, buf, sizeof(buf));
- if (nread == 0) {
- close(web->output.fd);
- web->output.fd = -1;
- }
if (nread == -1 && errno == EINTR) {
return;
}
+ if (nread <= 0) {
+ close(web->output.fd);
+ web->output.fd = -1;
+ nread = 0;
+ }
web->output.content = data_blob_talloc(web, buf, nread);
}