diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-03-11 06:35:03 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-03-11 06:35:03 +0000 |
commit | 976bacae944cde32da6dedb7910538929f933452 (patch) | |
tree | a29eee029da1af0164425ac497fc0922a932777e /src/or | |
parent | 060d721554695cd689d5873cdd366d59721ada46 (diff) | |
download | tor-976bacae944cde32da6dedb7910538929f933452.tar.gz tor-976bacae944cde32da6dedb7910538929f933452.zip |
Make all the other read/writes into recv/sends, except when they shouldn't be.
svn:r1260
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/cpuworker.c | 8 | ||||
-rw-r--r-- | src/or/dns.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 77e185fdf2..9fcf64bb09 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -132,19 +132,19 @@ int cpuworker_main(void *data) { for(;;) { - if(read(fd, &question_type, 1) != 1) { + if(recv(fd, &question_type, 1, 0) != 1) { // log_fn(LOG_ERR,"read type failed. Exiting."); log_fn(LOG_INFO,"cpuworker exiting because tor process died."); spawn_exit(); } assert(question_type == CPUWORKER_TASK_ONION); - if(read_all(fd, tag, TAG_LEN) != TAG_LEN) { + if(read_all(fd, tag, TAG_LEN, 1) != TAG_LEN) { log_fn(LOG_ERR,"read tag failed. Exiting."); spawn_exit(); } - if(read_all(fd, question, ONIONSKIN_CHALLENGE_LEN) != ONIONSKIN_CHALLENGE_LEN) { + if(read_all(fd, question, ONIONSKIN_CHALLENGE_LEN, 1) != ONIONSKIN_CHALLENGE_LEN) { log_fn(LOG_ERR,"read question failed. Exiting."); spawn_exit(); } @@ -163,7 +163,7 @@ int cpuworker_main(void *data) { memcpy(buf+1+TAG_LEN,reply_to_proxy,ONIONSKIN_REPLY_LEN); memcpy(buf+1+TAG_LEN+ONIONSKIN_REPLY_LEN,keys,40+32); } - if(write_all(fd, buf, LEN_ONION_RESPONSE) != LEN_ONION_RESPONSE) { + if(write_all(fd, buf, LEN_ONION_RESPONSE, 1) != LEN_ONION_RESPONSE) { log_fn(LOG_ERR,"writing response buf failed. Exiting."); spawn_exit(); } diff --git a/src/or/dns.c b/src/or/dns.c index 48a458a0c1..1f62414ab2 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -397,14 +397,14 @@ int dnsworker_main(void *data) { for(;;) { - if(read(fd, &address_len, 1) != 1) { + if(recv(fd, &address_len, 1, 0) != 1) { // log_fn(LOG_INFO,"read length failed. Child exiting."); log_fn(LOG_INFO,"dnsworker exiting because tor process died."); spawn_exit(); } assert(address_len > 0); - if(read_all(fd, address, address_len) != address_len) { + if(read_all(fd, address, address_len, 1) != address_len) { log_fn(LOG_ERR,"read hostname failed. Child exiting."); spawn_exit(); } @@ -413,13 +413,13 @@ int dnsworker_main(void *data) { rent = gethostbyname(address); if (!rent) { log_fn(LOG_INFO,"Could not resolve dest addr %s. Returning nulls.",address); - if(write_all(fd, "\0\0\0\0", 4) != 4) { + if(write_all(fd, "\0\0\0\0", 4, 1) != 4) { log_fn(LOG_ERR,"writing nulls failed. Child exiting."); spawn_exit(); } } else { assert(rent->h_length == 4); /* break to remind us if we move away from ipv4 */ - if(write_all(fd, rent->h_addr, 4) != 4) { + if(write_all(fd, rent->h_addr, 4, 1) != 4) { log_fn(LOG_INFO,"writing answer failed. Child exiting."); spawn_exit(); } |