[or-cvs] change WARNING to WARN

Roger Dingledine arma at seul.org
Fri Oct 10 01:48:36 UTC 2003


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common

Modified Files:
	crypto.c log.c log.h tortls.c util.c 
Log Message:
change WARNING to WARN


Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- crypto.c	8 Oct 2003 02:04:07 -0000	1.40
+++ crypto.c	10 Oct 2003 01:48:03 -0000	1.41
@@ -211,17 +211,17 @@
   crypto_cipher_env_t *crypto = NULL;
 
   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;
   }
 
   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;
   }
 
   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;
   }
   
@@ -231,7 +231,7 @@
     r = crypto_cipher_decrypt_init_cipher(crypto);
 
   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;
   }
   return crypto;
@@ -367,7 +367,7 @@
   
   /* read the private key */
   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);
     return -1;
   }
@@ -376,10 +376,10 @@
   /* check the private key */
   switch(crypto_pk_check_key(env)) {
     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;
     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;
     /* case 1: fall through */
   }
@@ -982,14 +982,14 @@
     n = fread(buf, 1, 20, f);
     fclose(f);
     if (n != 20) {
-      log_fn(LOG_WARNING, "Error reading from entropy source");
+      log_fn(LOG_WARN, "Error reading from entropy source");
       return -1;
     }
     RAND_seed(buf, 20);
     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;
 }
 

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- log.c	8 Oct 2003 02:04:07 -0000	1.22
+++ log.c	10 Oct 2003 01:48:03 -0000	1.23
@@ -18,7 +18,7 @@
   switch(severity) {
     case LOG_DEBUG:   return "debug";
     case LOG_INFO:    return "info";
-    case LOG_WARNING: return "warn";
+    case LOG_WARN:    return "warn";
     case LOG_ERR:     return "err";
     default:          assert(0); return "UNKNOWN";
   }

Index: log.h
===================================================================
RCS file: /home/or/cvsroot/src/common/log.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- log.h	7 Oct 2003 16:29:57 -0000	1.15
+++ log.h	10 Oct 2003 01:48:03 -0000	1.16
@@ -9,15 +9,12 @@
 
 #ifdef HAVE_SYSLOG_H
 #include <syslog.h>
+#define LOG_WARN LOG_WARNING
 #else
 #define LOG_DEBUG   0
 #define LOG_INFO    1
-#define LOG_NOTICE  2
-#define LOG_WARNING 3
+#define LOG_WARN    3
 #define LOG_ERR     4
-#define LOG_CRIT    5
-#define LOG_ALERT   6
-#define LOG_EMERG   7
 #endif
 
 /* magic to make GCC check for proper format strings. */ 

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- tortls.c	28 Sep 2003 06:47:29 -0000	1.18
+++ tortls.c	10 Oct 2003 01:48:03 -0000	1.19
@@ -215,7 +215,7 @@
   if (rsa) {
     cert = tor_tls_create_certificate(rsa, nickname);
     if (!cert) {
-      log(LOG_WARNING, "Error creating certificate");
+      log(LOG_WARN, "Error creating certificate");
       return -1;
     }
   }
@@ -415,7 +415,7 @@
        */
       if (tls->state == TOR_TLS_ST_GOTCLOSE || 
 	  tls->state == TOR_TLS_ST_SENTCLOSE) {
-	log(LOG_WARNING, 
+	log(LOG_WARN, 
 	    "TLS returned \"half-closed\" value while already half-closed");
 	return TOR_TLS_ERROR;
       }

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- util.c	7 Oct 2003 16:29:57 -0000	1.27
+++ util.c	10 Oct 2003 01:48:03 -0000	1.28
@@ -64,7 +64,7 @@
   long secdiff = end->tv_sec - start->tv_sec;
 
   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;
   }
 
@@ -335,17 +335,17 @@
   struct stat st;
   if (stat(dirname, &st)) {
     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));
       return -1;
     } 
     if (!create) {
-      log(LOG_WARNING, "Directory %s does not exist.", dirname);
+      log(LOG_WARN, "Directory %s does not exist.", dirname);
       return -1;
     }
     log(LOG_INFO, "Creating directory %s", dirname); 
     if (mkdir(dirname, 0700)) {
-      log(LOG_WARNING, "Error creating directory %s: %s", dirname, 
+      log(LOG_WARN, "Error creating directory %s: %s", dirname, 
           strerror(errno));
       return -1;
     } else {
@@ -353,17 +353,17 @@
     }
   }
   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;
   }
   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;
   }
   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)) {
-      log(LOG_WARNING, "Could not chmod directory %s: %s", dirname, 
+      log(LOG_WARN, "Could not chmod directory %s: %s", dirname, 
           strerror(errno));
       return -1;
     } else {
@@ -380,28 +380,28 @@
   int fd;
   FILE *file;
   if (strlen(fname) > 1000) {
-    log(LOG_WARNING, "Filename %s is too long.", fname);
+    log(LOG_WARN, "Filename %s is too long.", fname);
     return -1;
   }
   strcpy(tempname,fname);
   strcat(tempname,".tmp");
   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));
     return -1;
   }
   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));
     close(fd); return -1;
   }
   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);
   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 0;
@@ -415,7 +415,7 @@
   assert(filename);
 
   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;
   }
   
@@ -426,14 +426,14 @@
 
   fd = open(filename,O_RDONLY,0);
   if (fd<0) {
-    log_fn(LOG_WARNING,"Could not open %s.",filename);
+    log_fn(LOG_WARN,"Could not open %s.",filename);
     return NULL;
   }
 
   string = tor_malloc(statbuf.st_size+1);
 
   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);
     free(string);
     close(fd);
@@ -485,7 +485,7 @@
     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;
   }
   *end = 0; /* null it out */



More information about the tor-commits mailing list