wrowe 2002/08/03 18:35:45
Modified: include apr_errno.h
poll/unix poll.c
Log:
apr_get_netos_error() must be implemented on all platforms. Aren't
you unix folks already having trouble with h_errno v.s. errno?
Fix apr_poll to use apr_get_netos_error().
Submitted by: Rob Saccoccio <[EMAIL PROTECTED]>
Revision Changes Path
1.94 +7 -1 apr/include/apr_errno.h
Index: apr_errno.h
===================================================================
RCS file: /home/cvs/apr/include/apr_errno.h,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- apr_errno.h 16 Jul 2002 20:23:48 -0000 1.93
+++ apr_errno.h 4 Aug 2002 01:35:44 -0000 1.94
@@ -906,7 +906,7 @@
#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
-/* A special case, only Win32 winsock calls require this:
+/* A special case, only socket calls require this:
*/
#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
@@ -1072,6 +1072,12 @@
#define apr_get_os_error() (errno)
#define apr_set_os_error(e) (errno = (e))
+
+/* A special case, only socket calls require this:
+ * [Note: platforms using h_errno should replace this macro,
+ * although watch out for thread saftey issues with h_errno.]
+ */
+#define apr_get_netos_error() (errno)
/** no error */
#define APR_STATUS_IS_SUCCESS(s) ((s) == APR_SUCCESS)
1.25 +4 -4 apr/poll/unix/poll.c
Index: poll.c
===================================================================
RCS file: /home/cvs/apr/poll/unix/poll.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- poll.c 3 Aug 2002 00:10:57 -0000 1.24
+++ poll.c 4 Aug 2002 01:35:45 -0000 1.25
@@ -172,7 +172,7 @@
#endif
if ((*nsds) < 0) {
- return errno;
+ return apr_get_netos_error();
}
if ((*nsds) == 0) {
return APR_TIMEUP;
@@ -270,7 +270,7 @@
return APR_TIMEUP;
}
if ((*nsds) < 0) {
- return errno;
+ return apr_get_netos_error();
}
for (i = 0; i < num; i++) {
@@ -513,7 +513,7 @@
rv = poll(pollset->pollset, pollset->nelts, timeout);
(*num) = rv;
if (rv < 0) {
- return errno;
+ return apr_get_netos_error();
}
if (rv == 0) {
return APR_TIMEUP;
@@ -566,7 +566,7 @@
(*num) = rv;
if (rv < 0) {
- return errno;
+ return apr_get_netos_error();
}
if (rv == 0) {
return APR_TIMEUP;