aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2010-07-20 11:36:45 +0000
committerPhilipp Tölke <toelke@in.tum.de>2010-07-20 11:36:45 +0000
commit9cc6fe559312bf93a47bf19a019fef8c4f952f54 (patch)
treeb9b3f635ee403d0540eb943bc5b67d69d539a091 /src/vpn
parent4cde4cfe794999bc5337f9e560bd95cdbccdf00f (diff)
downloadgnunet-9cc6fe559312bf93a47bf19a019fef8c4f952f54.tar.gz
gnunet-9cc6fe559312bf93a47bf19a019fef8c4f952f54.zip
Handle EOF in the stream between daemon and helper
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-vpn-helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vpn/gnunet-vpn-helper.c b/src/vpn/gnunet-vpn-helper.c
index 928ede4c6..0cb5937a4 100644
--- a/src/vpn/gnunet-vpn-helper.c
+++ b/src/vpn/gnunet-vpn-helper.c
@@ -143,7 +143,7 @@ int main(int argc, char** argv) {
143 int write_fd_possible = 0; 143 int write_fd_possible = 0;
144 int write_stdout_possible = 0; 144 int write_stdout_possible = 0;
145outer: 145outer:
146 while(rea != 0 && wri != 0 && running == 1) { 146 while((rea == 1 || wri == 1) && running == 1) {
147 FD_ZERO(&fds_w); 147 FD_ZERO(&fds_w);
148 FD_ZERO(&fds_r); 148 FD_ZERO(&fds_r);
149 149
@@ -169,7 +169,7 @@ outer:
169 write_fd_possible = 0; 169 write_fd_possible = 0;
170 struct suid_packet *pkt = (struct suid_packet*) buf; 170 struct suid_packet *pkt = (struct suid_packet*) buf;
171 r = read(0, buf, sizeof(struct suid_packet_header)); 171 r = read(0, buf, sizeof(struct suid_packet_header));
172 if (r < 0) { 172 if (r <= 0) {
173 fprintf(stderr, "read-error: %m\n"); 173 fprintf(stderr, "read-error: %m\n");
174 shutdown(fd_tun, SHUT_WR); 174 shutdown(fd_tun, SHUT_WR);
175 shutdown(0, SHUT_RD); 175 shutdown(0, SHUT_RD);
@@ -202,7 +202,7 @@ outer:
202 } else if (write_stdout_possible && FD_ISSET(fd_tun, &fds_r)) { 202 } else if (write_stdout_possible && FD_ISSET(fd_tun, &fds_r)) {
203 write_stdout_possible = 0; 203 write_stdout_possible = 0;
204 r = read(fd_tun, buf, 65600); 204 r = read(fd_tun, buf, 65600);
205 if (r < 0) { 205 if (r <= 0) {
206 fprintf(stderr, "read-error: %m\n"); 206 fprintf(stderr, "read-error: %m\n");
207 shutdown(fd_tun, SHUT_RD); 207 shutdown(fd_tun, SHUT_RD);
208 shutdown(1, SHUT_WR); 208 shutdown(1, SHUT_WR);