aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-06-17 22:18:26 +0000
committerNick Mathewson <nickm@torproject.org>2003-06-17 22:18:26 +0000
commit95e5384af3edf2804275ce97b331fcface8365f0 (patch)
tree073a16b76b56f6f9d0c9c5c9cb887c4a2a501896 /src/common
parent6965a4696cf3b00a1f385cf3f3a562897fefdb09 (diff)
downloadtor-95e5384af3edf2804275ce97b331fcface8365f0.tar
tor-95e5384af3edf2804275ce97b331fcface8365f0.tar.gz
Change many files to new log_fn format
svn:r333
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c20
-rw-r--r--src/common/util.c8
2 files changed, 14 insertions, 14 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 8a9dd86c3..86851a14b 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -159,17 +159,17 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
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 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
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 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, unsigned char
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 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, unsigned char
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 @@ int crypto_seed_rng()
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;
}
diff --git a/src/common/util.c b/src/common/util.c
index 191fa84cd..4160b1678 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -13,7 +13,7 @@ void *tor_malloc(size_t size) {
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 @@ void
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 @@ tv_udiff(struct timeval *start, struct timeval *end)
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 @@ tv_udiff(struct timeval *start, struct timeval *end)
*/
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;