Commit 36fb8e83 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

change WARNING to WARN


svn:r570
parent ecfb3682
...@@ -211,17 +211,17 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode ...@@ -211,17 +211,17 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
crypto_cipher_env_t *crypto = NULL; crypto_cipher_env_t *crypto = NULL;
if (! (crypto = crypto_new_cipher_env(cipher_type))) { if (! (crypto = crypto_new_cipher_env(cipher_type))) {
log_fn(LOG_WARNING, "Unable to allocate crypto object"); log_fn(LOG_WARN, "Unable to allocate crypto object");
return NULL; return NULL;
} }
if (crypto_cipher_set_key(crypto, key)) { if (crypto_cipher_set_key(crypto, key)) {
log_fn(LOG_WARNING, "Unable to set key: %s", crypto_perror()); log_fn(LOG_WARN, "Unable to set key: %s", crypto_perror());
goto error; goto error;
} }
if (crypto_cipher_set_iv(crypto, iv)) { if (crypto_cipher_set_iv(crypto, iv)) {
log_fn(LOG_WARNING, "Unable to set iv: %s", crypto_perror()); log_fn(LOG_WARN, "Unable to set iv: %s", crypto_perror());
goto error; goto error;
} }
...@@ -231,7 +231,7 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode ...@@ -231,7 +231,7 @@ crypto_create_init_cipher(int cipher_type, char *key, char *iv, int encrypt_mode
r = crypto_cipher_decrypt_init_cipher(crypto); r = crypto_cipher_decrypt_init_cipher(crypto);
if (r) { if (r) {
log_fn(LOG_WARNING, "Unable to initialize cipher: %s", crypto_perror()); log_fn(LOG_WARN, "Unable to initialize cipher: %s", crypto_perror());
goto error; goto error;
} }
return crypto; return crypto;
...@@ -367,7 +367,7 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k ...@@ -367,7 +367,7 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
/* read the private key */ /* read the private key */
if(crypto_pk_read_private_key_from_file(env, f_pr) < 0) { if(crypto_pk_read_private_key_from_file(env, f_pr) < 0) {
log_fn(LOG_WARNING,"Error reading private key : %s",crypto_perror()); log_fn(LOG_WARN,"Error reading private key : %s",crypto_perror());
fclose(f_pr); fclose(f_pr);
return -1; return -1;
} }
...@@ -376,10 +376,10 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k ...@@ -376,10 +376,10 @@ int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *k
/* check the private key */ /* check the private key */
switch(crypto_pk_check_key(env)) { switch(crypto_pk_check_key(env)) {
case 0: case 0:
log_fn(LOG_WARNING,"Private key read but is invalid : %s.", crypto_perror()); log_fn(LOG_WARN,"Private key read but is invalid : %s.", crypto_perror());
return -1; return -1;
case -1: case -1:
log_fn(LOG_WARNING,"Private key read but validity checking failed : %s",crypto_perror()); log_fn(LOG_WARN,"Private key read but validity checking failed : %s",crypto_perror());
return -1; return -1;
/* case 1: fall through */ /* case 1: fall through */
} }
...@@ -982,14 +982,14 @@ int crypto_seed_rng() ...@@ -982,14 +982,14 @@ int crypto_seed_rng()
n = fread(buf, 1, 20, f); n = fread(buf, 1, 20, f);
fclose(f); fclose(f);
if (n != 20) { if (n != 20) {
log_fn(LOG_WARNING, "Error reading from entropy source"); log_fn(LOG_WARN, "Error reading from entropy source");
return -1; return -1;
} }
RAND_seed(buf, 20); RAND_seed(buf, 20);
return 0; return 0;
} }
log_fn(LOG_WARNING, "Cannot seed RNG -- no entropy source found."); log_fn(LOG_WARN, "Cannot seed RNG -- no entropy source found.");
return -1; return -1;
} }
......
...@@ -18,7 +18,7 @@ static INLINE const char *sev_to_string(int severity) { ...@@ -18,7 +18,7 @@ static INLINE const char *sev_to_string(int severity) {
switch(severity) { switch(severity) {
case LOG_DEBUG: return "debug"; case LOG_DEBUG: return "debug";
case LOG_INFO: return "info"; case LOG_INFO: return "info";
case LOG_WARNING: return "warn"; case LOG_WARN: return "warn";
case LOG_ERR: return "err"; case LOG_ERR: return "err";
default: assert(0); return "UNKNOWN"; default: assert(0); return "UNKNOWN";
} }
......
...@@ -9,15 +9,12 @@ ...@@ -9,15 +9,12 @@
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
#include <syslog.h> #include <syslog.h>
#define LOG_WARN LOG_WARNING
#else #else
#define LOG_DEBUG 0 #define LOG_DEBUG 0
#define LOG_INFO 1 #define LOG_INFO 1
#define LOG_NOTICE 2 #define LOG_WARN 3
#define LOG_WARNING 3
#define LOG_ERR 4 #define LOG_ERR 4
#define LOG_CRIT 5
#define LOG_ALERT 6
#define LOG_EMERG 7
#endif #endif
/* magic to make GCC check for proper format strings. */ /* magic to make GCC check for proper format strings. */
......
...@@ -215,7 +215,7 @@ tor_tls_context_new(crypto_pk_env_t *rsa, ...@@ -215,7 +215,7 @@ tor_tls_context_new(crypto_pk_env_t *rsa,
if (rsa) { if (rsa) {
cert = tor_tls_create_certificate(rsa, nickname); cert = tor_tls_create_certificate(rsa, nickname);
if (!cert) { if (!cert) {
log(LOG_WARNING, "Error creating certificate"); log(LOG_WARN, "Error creating certificate");
return -1; return -1;
} }
} }
...@@ -415,7 +415,7 @@ tor_tls_shutdown(tor_tls *tls) ...@@ -415,7 +415,7 @@ tor_tls_shutdown(tor_tls *tls)
*/ */
if (tls->state == TOR_TLS_ST_GOTCLOSE || if (tls->state == TOR_TLS_ST_GOTCLOSE ||
tls->state == TOR_TLS_ST_SENTCLOSE) { tls->state == TOR_TLS_ST_SENTCLOSE) {
log(LOG_WARNING, log(LOG_WARN,
"TLS returned \"half-closed\" value while already half-closed"); "TLS returned \"half-closed\" value while already half-closed");
return TOR_TLS_ERROR; return TOR_TLS_ERROR;
} }
......
...@@ -64,7 +64,7 @@ tv_udiff(struct timeval *start, struct timeval *end) ...@@ -64,7 +64,7 @@ tv_udiff(struct timeval *start, struct timeval *end)
long secdiff = end->tv_sec - start->tv_sec; long secdiff = end->tv_sec - start->tv_sec;
if (secdiff+1 > LONG_MAX/1000000) { if (secdiff+1 > LONG_MAX/1000000) {
log_fn(LOG_WARNING, "comparing times too far apart."); log_fn(LOG_WARN, "comparing times too far apart.");
return LONG_MAX; return LONG_MAX;
} }
...@@ -335,17 +335,17 @@ int check_private_dir(const char *dirname, int create) ...@@ -335,17 +335,17 @@ int check_private_dir(const char *dirname, int create)
struct stat st; struct stat st;
if (stat(dirname, &st)) { if (stat(dirname, &st)) {
if (errno != ENOENT) { if (errno != ENOENT) {
log(LOG_WARNING, "Directory %s cannot be read: %s", dirname, log(LOG_WARN, "Directory %s cannot be read: %s", dirname,
strerror(errno)); strerror(errno));
return -1; return -1;
} }
if (!create) { if (!create) {
log(LOG_WARNING, "Directory %s does not exist.", dirname); log(LOG_WARN, "Directory %s does not exist.", dirname);
return -1; return -1;
} }
log(LOG_INFO, "Creating directory %s", dirname); log(LOG_INFO, "Creating directory %s", dirname);
if (mkdir(dirname, 0700)) { if (mkdir(dirname, 0700)) {
log(LOG_WARNING, "Error creating directory %s: %s", dirname, log(LOG_WARN, "Error creating directory %s: %s", dirname,
strerror(errno)); strerror(errno));
return -1; return -1;
} else { } else {
...@@ -353,17 +353,17 @@ int check_private_dir(const char *dirname, int create) ...@@ -353,17 +353,17 @@ int check_private_dir(const char *dirname, int create)
} }
} }
if (!(st.st_mode & S_IFDIR)) { if (!(st.st_mode & S_IFDIR)) {
log(LOG_WARNING, "%s is not a directory", dirname); log(LOG_WARN, "%s is not a directory", dirname);
return -1; return -1;
} }
if (st.st_uid != getuid()) { if (st.st_uid != getuid()) {
log(LOG_WARNING, "%s is not owned by this UID (%d)", dirname, getuid()); log(LOG_WARN, "%s is not owned by this UID (%d)", dirname, getuid());
return -1; return -1;
} }
if (st.st_mode & 0077) { if (st.st_mode & 0077) {
log(LOG_WARNING, "Fixing permissions on directory %s", dirname); log(LOG_WARN, "Fixing permissions on directory %s", dirname);
if (chmod(dirname, 0700)) { if (chmod(dirname, 0700)) {
log(LOG_WARNING, "Could not chmod directory %s: %s", dirname, log(LOG_WARN, "Could not chmod directory %s: %s", dirname,
strerror(errno)); strerror(errno));
return -1; return -1;
} else { } else {
...@@ -380,28 +380,28 @@ write_str_to_file(const char *fname, const char *str) ...@@ -380,28 +380,28 @@ write_str_to_file(const char *fname, const char *str)
int fd; int fd;
FILE *file; FILE *file;
if (strlen(fname) > 1000) { if (strlen(fname) > 1000) {
log(LOG_WARNING, "Filename %s is too long.", fname); log(LOG_WARN, "Filename %s is too long.", fname);
return -1; return -1;
} }
strcpy(tempname,fname); strcpy(tempname,fname);
strcat(tempname,".tmp"); strcat(tempname,".tmp");
if ((fd = open(tempname, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0) { if ((fd = open(tempname, O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0) {
log(LOG_WARNING, "Couldn't open %s for writing: %s", tempname, log(LOG_WARN, "Couldn't open %s for writing: %s", tempname,
strerror(errno)); strerror(errno));
return -1; return -1;
} }
if (!(file = fdopen(fd, "w"))) { if (!(file = fdopen(fd, "w"))) {
log(LOG_WARNING, "Couldn't fdopen %s for writing: %s", tempname, log(LOG_WARN, "Couldn't fdopen %s for writing: %s", tempname,
strerror(errno)); strerror(errno));
close(fd); return -1; close(fd); return -1;
} }
if (fputs(str,file) == EOF) { if (fputs(str,file) == EOF) {
log(LOG_WARNING, "Error writing to %s: %s", tempname, strerror(errno)); log(LOG_WARN, "Error writing to %s: %s", tempname, strerror(errno));
fclose(file); return -1; fclose(file); return -1;
} }
fclose(file); fclose(file);
if (rename(tempname, fname)) { if (rename(tempname, fname)) {
log(LOG_WARNING, "Error replacing %s: %s", fname, strerror(errno)); log(LOG_WARN, "Error replacing %s: %s", fname, strerror(errno));
return -1; return -1;
} }
return 0; return 0;
...@@ -415,7 +415,7 @@ char *read_file_to_str(const char *filename) { ...@@ -415,7 +415,7 @@ char *read_file_to_str(const char *filename) {
assert(filename); assert(filename);
if(strcspn(filename,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) { if(strcspn(filename,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
log_fn(LOG_WARNING,"Filename %s contains illegal characters.",filename); log_fn(LOG_WARN,"Filename %s contains illegal characters.",filename);
return NULL; return NULL;
} }
...@@ -426,14 +426,14 @@ char *read_file_to_str(const char *filename) { ...@@ -426,14 +426,14 @@ char *read_file_to_str(const char *filename) {
fd = open(filename,O_RDONLY,0); fd = open(filename,O_RDONLY,0);
if (fd<0) { if (fd<0) {
log_fn(LOG_WARNING,"Could not open %s.",filename); log_fn(LOG_WARN,"Could not open %s.",filename);
return NULL; return NULL;
} }
string = tor_malloc(statbuf.st_size+1); string = tor_malloc(statbuf.st_size+1);
if(read_all(fd,string,statbuf.st_size) != statbuf.st_size) { if(read_all(fd,string,statbuf.st_size) != statbuf.st_size) {
log_fn(LOG_WARNING,"Couldn't read all %ld bytes of file '%s'.", log_fn(LOG_WARN,"Couldn't read all %ld bytes of file '%s'.",
(long)statbuf.st_size,filename); (long)statbuf.st_size,filename);
free(string); free(string);
close(fd); close(fd);
...@@ -485,7 +485,7 @@ try_next_line: ...@@ -485,7 +485,7 @@ try_next_line:
value++; value++;
if(!*end || !*value) { /* only a key on this line. no value. */ if(!*end || !*value) { /* only a key on this line. no value. */
log_fn(LOG_WARNING,"Line has keyword '%s' but no value. Skipping.",s); log_fn(LOG_WARN,"Line has keyword '%s' but no value. Skipping.",s);
goto try_next_line; goto try_next_line;
} }
*end = 0; /* null it out */ *end = 0; /* null it out */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment