[or-cvs] Change many files to new log_fn format

Nick Mathewson nickm at seul.org
Tue Jun 17 22:18:27 UTC 2003


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv17275/src/common

Modified Files:
	crypto.c util.c 
Log Message:
Change many files to new log_fn format

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- crypto.c	17 Jun 2003 20:19:41 -0000	1.23
+++ crypto.c	17 Jun 2003 22:18:25 -0000	1.24
@@ -159,17 +159,17 @@
   crypto_cipher_env_t *crypto = NULL;
 
   if (! (crypto = crypto_new_cipher_env(cipher_type))) {
-    log(LOG_ERR, "Unable to allocate crypto object");
+    log_fn(LOG_ERR, "Unable to allocate crypto object");
     return NULL;
   }
 
   if (crypto_cipher_set_key(crypto, key)) {
-    log(LOG_ERR, "Unable to set key: %s", crypto_perror());
+    log_fn(LOG_ERR, "Unable to set key: %s", crypto_perror());
     goto error;
   }
 
   if (crypto_cipher_set_iv(crypto, iv)) {
-    log(LOG_ERR, "Unable to set iv: %s", crypto_perror());
+    log_fn(LOG_ERR, "Unable to set iv: %s", crypto_perror());
     goto error;
   }
   
@@ -179,7 +179,7 @@
     r = crypto_cipher_decrypt_init_cipher(crypto);
 
   if (r) {
-    log(LOG_ERR, "Unabble to initialize cipher: %s", crypto_perror());
+    log_fn(LOG_ERR, "Unabble to initialize cipher: %s", crypto_perror());
     goto error;
   }
   return crypto;
@@ -310,7 +310,7 @@
     fclose(f_pr);
     if (retval == -1)
     {
-      log(LOG_ERR,"Error reading private key : %s",crypto_perror());
+      log_fn(LOG_ERR,"Error reading private key : %s",crypto_perror());
       return -1;
     }
       
@@ -318,12 +318,12 @@
     retval = crypto_pk_check_key(env);
     if (retval == 0)
     {
-      log(LOG_ERR,"Private key read but is invalid : %s.", crypto_perror());
+      log_fn(LOG_ERR,"Private key read but is invalid : %s.", crypto_perror());
       return -1;
     }
     else if (retval == -1)
     {
-      log(LOG_ERR,"Private key read but validity checking failed : %s",crypto_perror());
+      log_fn(LOG_ERR,"Private key read but validity checking failed : %s",crypto_perror());
       return -1;
     }
     else if (retval == 1)
@@ -799,19 +799,19 @@
   for (i = 0; filenames[i]; ++i) {
     f = fopen(filenames[i], "rb");
     if (!f) continue;
-    log(LOG_INFO, "Seeding RNG from %s", filenames[i]);
+    log_fn(LOG_INFO, "Seeding RNG from %s", filenames[i]);
     buf[20]='\xff';
     n = fread(buf, 1, 20, f);
     fclose(f);
     if (n != 20) {
-      log(LOG_INFO, "Error reading from entropy source");
+      log_fn(LOG_INFO, "Error reading from entropy source");
       return -1;
     }
     RAND_seed(buf, 20);
     return 0;
   }
 
-  log(LOG_INFO, "Cannot seed RNG -- no entropy source found.");
+  log_fn(LOG_INFO, "Cannot seed RNG -- no entropy source found.");
   return -1;
 }
 

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- util.c	20 May 2003 06:37:34 -0000	1.5
+++ util.c	17 Jun 2003 22:18:25 -0000	1.6
@@ -13,7 +13,7 @@
   result = malloc(size);
 
   if(!result) {
-    log(LOG_ERR,"tor_malloc(): Out of memory. Dying.");
+    log_fn(LOG_ERR, "Out of memory. Dying.");
     exit(1);
   }
 
@@ -24,7 +24,7 @@
 my_gettimeofday(struct timeval *timeval) 
 {
   if (gettimeofday(timeval, NULL)) {
-    log(LOG_ERR, "my_gettimeofday: gettimeofday failed.");
+    log_fn(LOG_ERR, "gettimeofday failed.");
     /* If gettimeofday dies, we have either given a bad timezone (we didn't),
        or segfaulted.*/
     exit(1);
@@ -40,7 +40,7 @@
   long secdiff = end->tv_sec - start->tv_sec;
 
   if (secdiff+1 > LONG_MAX/1000000) {
-    log(LOG_NOTICE, "tv_udiff(): comparing times too far apart.");
+    log_fn(LOG_NOTICE, "comparing times too far apart.");
     return LONG_MAX;
   }
 
@@ -54,7 +54,7 @@
   */
   udiff = secdiff*1000000L + (end_usec - start->tv_usec);
   if(udiff < 0) {
-    log(LOG_NOTICE, "tv_udiff(): start is after end. Returning 0.");
+    log_fn(LOG_NOTICE, "start is after end. Returning 0.");
     return 0;
   }
   return udiff;



More information about the tor-commits mailing list