[WININET]

- Add a ROS-specific change that was missed during the last winesync to fix winsock error handling
- Remove the CP_UNIXCP definition
- Use WSASetLastError instead of errno in inet_ntop.c
- Thanks to IRC:igorko for pointing out the bug

svn path=/trunk/; revision=49078
This commit is contained in:
Cameron Gutman 2010-10-09 18:40:16 +00:00
parent de743e0f9b
commit f39c42c8c2
3 changed files with 6 additions and 11 deletions

View file

@ -16,9 +16,6 @@
* SOFTWARE. * SOFTWARE.
*/ */
#define ENOSPC 28
#define EAFNOSUPPORT 52
#ifndef IN6ADDRSZ #ifndef IN6ADDRSZ
#define IN6ADDRSZ 16 #define IN6ADDRSZ 16
#endif #endif
@ -64,7 +61,7 @@ inet_ntop(int af, const void *src, char *dst, size_t size)
return (inet_ntop6(src, dst, size)); return (inet_ntop6(src, dst, size));
#endif #endif
default: default:
errno = EAFNOSUPPORT; WSASetLastError(WSAEAFNOSUPPORT);
return (NULL); return (NULL);
} }
/* NOTREACHED */ /* NOTREACHED */
@ -88,7 +85,7 @@ inet_ntop4(const u_char *src, char *dst, size_t size)
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
errno = ENOSPC; WSASetLastError(WSAEINVAL);
return (NULL); return (NULL);
} }
strcpy(dst, tmp); strcpy(dst, tmp);
@ -182,7 +179,7 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
* Check for overflow, copy, and we're done. * Check for overflow, copy, and we're done.
*/ */
if ((size_t)(tp - tmp) > size) { if ((size_t)(tp - tmp) > size) {
errno = ENOSPC; WSASetLastError(WSAEINVAL);
return (NULL); return (NULL);
} }
strcpy(dst, tmp); strcpy(dst, tmp);

View file

@ -47,10 +47,6 @@
#define ioctlsocket ioctl #define ioctlsocket ioctl
#endif /* __MINGW32__ */ #endif /* __MINGW32__ */
/* ReactOS-specific definitions */
#undef CP_UNIXCP
#define CP_UNIXCP CP_THREAD_ACP
/* used for netconnection.c stuff */ /* used for netconnection.c stuff */
typedef struct typedef struct
{ {
@ -441,7 +437,7 @@ DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int
BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available); BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available);
LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection); LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection);
DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value); DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value);
int sock_get_error(int); #define sock_get_error(x) WSAGetLastError()
extern void URLCacheContainers_CreateDefaults(void); extern void URLCacheContainers_CreateDefaults(void);
extern void URLCacheContainers_DeleteAll(void); extern void URLCacheContainers_DeleteAll(void);

View file

@ -513,6 +513,7 @@ BOOL NETCON_connected(WININET_NETCONNECTION *connection)
return TRUE; return TRUE;
} }
#if 0
/* translate a unix error code into a winsock one */ /* translate a unix error code into a winsock one */
int sock_get_error( int err ) int sock_get_error( int err )
{ {
@ -579,6 +580,7 @@ int sock_get_error( int err )
#endif #endif
return err; return err;
} }
#endif
/****************************************************************************** /******************************************************************************
* NETCON_create * NETCON_create