[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torsocks/master] Fix: check fileno returned value



commit 729ca3f504b16f6e67d587cb8616daf7efc61f66
Author: David Goulet <dgoulet@xxxxxxxxx>
Date:   Tue Oct 8 19:24:18 2013 -0400

    Fix: check fileno returned value
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxx>
---
 src/common/log.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/common/log.c b/src/common/log.c
index 472dc49..2b6e542 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -163,9 +163,10 @@ 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. */
-		(void) fileno(stderr);
-		if (errno != EBADF) {
+		ret = fileno(stderr);
+		if (ret < 0 && errno != EBADF) {
 			logconfig.fp = stderr;
+			ret = 0;
 		}
 	}
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits