[or-cvs] Some platforms have weird translations when you open files ...
Nick Mathewson
nickm at seul.org
Wed Sep 8 07:16:36 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv29891/src/or
Modified Files:
dirserv.c main.c rendservice.c router.c routerlist.c
Log Message:
Some platforms have weird translations when you open files in "test" mode; make read/write_str_to_file aware.
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- dirserv.c 8 Sep 2004 06:52:33 -0000 1.77
+++ dirserv.c 8 Sep 2004 07:16:33 -0000 1.78
@@ -652,7 +652,7 @@
cached_directory_published = when;
if(get_data_directory(&options)) {
sprintf(filename,"%s/cached-directory", get_data_directory(&options));
- if(write_str_to_file(filename,cached_directory) < 0) {
+ if(write_str_to_file(filename,cached_directory,0) < 0) {
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
}
@@ -725,7 +725,7 @@
free(new_directory);
if(get_data_directory(&options)) {
sprintf(filename,"%s/cached-directory", get_data_directory(&options));
- if(write_str_to_file(filename,the_directory) < 0) {
+ if(write_str_to_file(filename,the_directory,0) < 0) {
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
}
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.324
retrieving revision 1.325
diff -u -d -r1.324 -r1.325
--- main.c 8 Sep 2004 06:52:33 -0000 1.324
+++ main.c 8 Sep 2004 07:16:33 -0000 1.325
@@ -764,7 +764,7 @@
router_rebuild_descriptor();
sprintf(keydir,"%s/router.desc", get_data_directory(&options));
log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir);
- if (write_str_to_file(keydir, router_get_my_descriptor())) {
+ if (write_str_to_file(keydir, router_get_my_descriptor(), 0)) {
return -1;
}
}
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- rendservice.c 18 Aug 2004 05:05:58 -0000 1.81
+++ rendservice.c 8 Sep 2004 07:16:33 -0000 1.82
@@ -317,7 +317,7 @@
return -1;
}
sprintf(buf, "%s.onion\n", s->service_id);
- if (write_str_to_file(fname,buf)<0)
+ if (write_str_to_file(fname,buf,0)<0)
return -1;
}
return 0;
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- router.c 18 Aug 2004 04:44:24 -0000 1.85
+++ router.c 8 Sep 2004 07:16:33 -0000 1.86
@@ -319,7 +319,7 @@
sprintf(keydir,"%s/router.desc", datadir);
log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir);
- if (write_str_to_file(keydir, mydesc)) {
+ if (write_str_to_file(keydir, mydesc,0)) {
return -1;
}
/* 5. Dump fingerprint to 'fingerprint' */
@@ -334,7 +334,7 @@
return -1;
}
strcat(fingerprint, "\n");
- if (write_str_to_file(keydir, fingerprint))
+ if (write_str_to_file(keydir, fingerprint, 0))
return -1;
if(!authdir_mode())
return 0;
@@ -348,7 +348,7 @@
/* 7. [authdirserver only] load old directory, if it's there */
sprintf(keydir,"%s/cached-directory", datadir);
log_fn(LOG_INFO,"Loading cached directory from %s...",keydir);
- cp = read_file_to_str(keydir);
+ cp = read_file_to_str(keydir,0);
if(!cp) {
log_fn(LOG_INFO,"Cached directory %s not present. Ok.",keydir);
} else {
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- routerlist.c 8 Sep 2004 06:52:33 -0000 1.135
+++ routerlist.c 8 Sep 2004 07:16:34 -0000 1.136
@@ -60,7 +60,7 @@
if (get_data_directory(&options)) {
char *s;
sprintf(filename,"%s/cached-directory", get_data_directory(&options));
- s = read_file_to_str(filename);
+ s = read_file_to_str(filename,0);
if (s) {
log_fn(LOG_INFO, "Loading cached directory from %s", filename);
if (router_load_routerlist_from_string(s, 0) < 0) {
@@ -693,7 +693,7 @@
{
char *string;
- string = read_file_to_str(routerfile);
+ string = read_file_to_str(routerfile,0);
if(!string) {
log_fn(LOG_WARN,"Failed to load routerfile %s.",routerfile);
return -1;
More information about the tor-commits
mailing list