Continue to read also when signals are sent.

git-svn-id: https://unbound.nlnetlabs.nl/svn/trunk@4723 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
wouter 2018-06-12 10:50:51 +00:00
parent 83da630f76
commit d14abd4a57

View File

@ -614,14 +614,19 @@ ssl_read_line(RES* res, char* buf, size_t max)
return 0;
}
} else {
ssize_t rr = read(res->fd, buf+len, 1);
if(rr <= 0) {
if(rr == 0) {
buf[len] = 0;
return 1;
while(1) {
ssize_t rr = read(res->fd, buf+len, 1);
if(rr <= 0) {
if(rr == 0) {
buf[len] = 0;
return 1;
}
if(errno == EINTR || errno == EAGAIN)
continue;
log_err("could not read: %s", strerror(errno));
return 0;
}
log_err("could not read: %s", strerror(errno));
return 0;
break;
}
}
if(buf[len] == '\n') {
@ -2935,13 +2940,18 @@ handle_req(struct daemon_remote* rc, struct rc_state* s, RES* res)
return;
}
} else {
ssize_t rr = read(res->fd, magic, sizeof(magic)-1);
if(rr < (ssize_t)sizeof(magic)-1) {
if(rr == 0) return;
log_err("could not read: %s", strerror(errno));
return;
while(1) {
ssize_t rr = read(res->fd, magic, sizeof(magic)-1);
if(rr <= 0) {
if(rr == 0) return;
if(errno == EINTR || errno == EAGAIN)
continue;
log_err("could not read: %s", strerror(errno));
return;
}
r = (int)rr;
break;
}
r = (int)rr;
}
magic[6] = 0;
if( r != 6 || strncmp(magic, "UBCT", 4) != 0) {