aboutsummaryrefslogtreecommitdiff
path: root/src/or/routers.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-09-28 06:48:20 +0000
committerRoger Dingledine <arma@torproject.org>2003-09-28 06:48:20 +0000
commitc4c66e2c7f1184336d5a9997d049ba4e28137c39 (patch)
tree662e8507c686a12e82050fb6ccece837bcab43f5 /src/or/routers.c
parent677707433e562eec675d5e6e487a008364ebea5b (diff)
downloadtor-c4c66e2c7f1184336d5a9997d049ba4e28137c39.tar.gz
tor-c4c66e2c7f1184336d5a9997d049ba4e28137c39.zip
expand the scheduler to address SSL_read()'s pending bytes
svn:r505
Diffstat (limited to 'src/or/routers.c')
-rw-r--r--src/or/routers.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index 9c43cdde3c..e8995a8547 100644
--- a/src/or/routers.c
+++ b/src/or/routers.c
@@ -260,42 +260,14 @@ void router_forget_router(uint32_t addr, uint16_t port) {
/* load the router list */
int router_get_list_from_file(char *routerfile)
{
- int fd; /* router file */
- struct stat statbuf;
char *string;
- assert(routerfile);
-
- if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
- log_fn(LOG_WARNING,"Filename %s contains illegal characters.",routerfile);
+ string = read_file_to_str(routerfile);
+ if(!string) {
+ log_fn(LOG_WARNING,"Failed to load routerfile %s.",routerfile);
return -1;
}
- if(stat(routerfile, &statbuf) < 0) {
- log_fn(LOG_WARNING,"Could not stat %s.",routerfile);
- return -1;
- }
-
- /* open the router list */
- fd = open(routerfile,O_RDONLY,0);
- if (fd<0) {
- log_fn(LOG_WARNING,"Could not open %s.",routerfile);
- return -1;
- }
-
- string = tor_malloc(statbuf.st_size+1);
-
- if(read(fd,string,statbuf.st_size) != statbuf.st_size) {
- log_fn(LOG_WARNING,"Couldn't read all %ld bytes of file '%s'.",
- (long)statbuf.st_size,routerfile);
- free(string);
- close(fd);
- return -1;
- }
- close(fd);
-
- string[statbuf.st_size] = 0; /* null terminate it */
-
if(router_get_list_from_string(string) < 0) {
log_fn(LOG_WARNING,"The routerfile itself was corrupt.");
free(string);