[or-cvs] remember; tor_socket_errno has side effects!

Nick Mathewson nickm at seul.org
Sun Nov 28 05:48:04 UTC 2004


Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv23637/src/common

Modified Files:
	compat.c 
Log Message:
remember; tor_socket_errno has side effects!

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- compat.c	26 Nov 2004 04:00:52 -0000	1.12
+++ compat.c	28 Nov 2004 05:48:02 -0000	1.13
@@ -582,6 +582,10 @@
  * get your errors from WSAGetLastError, not errno.  (If you supply a
  * socket of -1, we check WSAGetLastError, but don't correct
  * WSAEWOULDBLOCKs.)
+ *
+ * The upshot of all of this is that when a socket call fails, you
+ * should call tor_socket_errno <em>at most once</em> on the failing
+ * socket to get the error.
  */
 #ifdef MS_WINDOWS
 int tor_socket_errno(int sock)



More information about the tor-commits mailing list