[tor-commits] [torsocks/master] Fix: bad ret value check for default logging

dgoulet at torproject.org dgoulet at torproject.org
Fri Apr 4 22:40:26 UTC 2014


commit 49200e32702a3ea14e5254df03825813b55b994b
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Wed Oct 30 12:04:27 2013 -0400

    Fix: bad ret value check for default logging
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/common/log.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/log.c b/src/common/log.c
index 2b6e542..b68d66b 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -137,7 +137,7 @@ int log_init(int level, const char *filepath, enum log_time_status t_status)
 {
 	int ret = 0;
 
-	/* Reset logconfig. Useful if this is call multiple times. */
+	/* Reset logconfig. Useful if this is called multiple times. */
 	memset(&logconfig, 0, sizeof(logconfig));
 
 	if (level < MSGNONE || level > MSGDEBUG) {
@@ -164,7 +164,7 @@ int log_init(int level, const char *filepath, enum log_time_status t_status)
 	} else {
 		/* The default output is stderr if no filepath is given. */
 		ret = fileno(stderr);
-		if (ret < 0 && errno != EBADF) {
+		if (ret >= 0 && errno != EBADF) {
 			logconfig.fp = stderr;
 			ret = 0;
 		}





More information about the tor-commits mailing list