malmond / rpms / unbound

Forked from rpms/unbound 3 years ago
Clone

Blame SOURCES/unbound-1.7.3-use-basic-lock.patch

45f416
diff --git a/util/log.c b/util/log.c
45f416
index 75a58f9..43dd572 100644
45f416
--- a/util/log.c
45f416
+++ b/util/log.c
45f416
@@ -70,7 +70,7 @@ static int key_created = 0;
45f416
 static ub_thread_key_type logkey;
45f416
 #ifndef THREADS_DISABLED
45f416
 /** pthread mutex to protect FILE* */
45f416
-static lock_quick_type log_lock;
45f416
+static lock_basic_type log_lock;
45f416
 #endif
45f416
 /** the identity of this executable/process */
45f416
 static const char* ident="unbound";
45f416
@@ -90,18 +90,18 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
45f416
 	if(!key_created) {
45f416
 		key_created = 1;
45f416
 		ub_thread_key_create(&logkey, NULL);
45f416
-		lock_quick_init(&log_lock);
45f416
+		lock_basic_init(&log_lock);
45f416
 	}
45f416
-	lock_quick_lock(&log_lock);
45f416
+	lock_basic_lock(&log_lock);
45f416
 	if(logfile 
45f416
 #if defined(HAVE_SYSLOG_H) || defined(UB_ON_WINDOWS)
45f416
 	|| logging_to_syslog
45f416
 #endif
45f416
 	) {
45f416
-		lock_quick_unlock(&log_lock); /* verbose() needs the lock */
45f416
+		lock_basic_unlock(&log_lock); /* verbose() needs the lock */
45f416
 		verbose(VERB_QUERY, "switching log to %s", 
45f416
 			use_syslog?"syslog":(filename&&filename[0]?filename:"stderr"));
45f416
-		lock_quick_lock(&log_lock);
45f416
+		lock_basic_lock(&log_lock);
45f416
 	}
45f416
 	if(logfile && logfile != stderr) {
45f416
 		FILE* cl = logfile;
45f416
@@ -119,7 +119,7 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
45f416
 		 * chroot and no longer be able to access dev/log and so on */
45f416
 		openlog(ident, LOG_NDELAY, LOG_DAEMON);
45f416
 		logging_to_syslog = 1;
45f416
-		lock_quick_unlock(&log_lock);
45f416
+		lock_basic_unlock(&log_lock);
45f416
 		return;
45f416
 	}
45f416
 #elif defined(UB_ON_WINDOWS)
45f416
@@ -128,13 +128,13 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
45f416
 	}
45f416
 	if(use_syslog) {
45f416
 		logging_to_syslog = 1;
45f416
-		lock_quick_unlock(&log_lock);
45f416
+		lock_basic_unlock(&log_lock);
45f416
 		return;
45f416
 	}
45f416
 #endif /* HAVE_SYSLOG_H */
45f416
 	if(!filename || !filename[0]) {
45f416
 		logfile = stderr;
45f416
-		lock_quick_unlock(&log_lock);
45f416
+		lock_basic_unlock(&log_lock);
45f416
 		return;
45f416
 	}
45f416
 	/* open the file for logging */
45f416
@@ -143,7 +143,7 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
45f416
 		filename += strlen(chrootdir);
45f416
 	f = fopen(filename, "a");
45f416
 	if(!f) {
45f416
-		lock_quick_unlock(&log_lock);
45f416
+		lock_basic_unlock(&log_lock);
45f416
 		log_err("Could not open logfile %s: %s", filename, 
45f416
 			strerror(errno));
45f416
 		return;
45f416
@@ -153,14 +153,14 @@ log_init(const char* filename, int use_syslog, const char* chrootdir)
45f416
 	setvbuf(f, NULL, (int)_IOLBF, 0);
45f416
 #endif
45f416
 	logfile = f;
45f416
-	lock_quick_unlock(&log_lock);
45f416
+	lock_basic_unlock(&log_lock);
45f416
 }
45f416
 
45f416
 void log_file(FILE *f)
45f416
 {
45f416
-	lock_quick_lock(&log_lock);
45f416
+	lock_basic_lock(&log_lock);
45f416
 	logfile = f;
45f416
-	lock_quick_unlock(&log_lock);
45f416
+	lock_basic_unlock(&log_lock);
45f416
 }
45f416
 
45f416
 void log_thread_set(int* num)
45f416
@@ -250,9 +250,9 @@ log_vmsg(int pri, const char* type,
45f416
 		return;
45f416
 	}
45f416
 #endif /* HAVE_SYSLOG_H */
45f416
-	lock_quick_lock(&log_lock);
45f416
+	lock_basic_lock(&log_lock);
45f416
 	if(!logfile) {
45f416
-		lock_quick_unlock(&log_lock);
45f416
+		lock_basic_unlock(&log_lock);
45f416
 		return;
45f416
 	}
45f416
 	if(log_now)
45f416
@@ -279,7 +279,7 @@ log_vmsg(int pri, const char* type,
45f416
 	/* line buffering does not work on windows */
45f416
 	fflush(logfile);
45f416
 #endif
45f416
-	lock_quick_unlock(&log_lock);
45f416
+	lock_basic_unlock(&log_lock);
45f416
 }
45f416
 
45f416
 /**