Fix the BLOCK_ADJUST_ERRNO() macro to behave properly in blocking mode.
Этот коммит содержится в:
родитель
de0c4159bf
Коммит
5936d9ce4e
@ -1248,11 +1248,18 @@ int _libssh2_pem_decode_integer(unsigned char **data, unsigned int *datalen,
|
|||||||
break; \
|
break; \
|
||||||
} while(1)
|
} while(1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For functions that returns a pointer, we need to check if the API is
|
||||||
|
* non-blocking and return immediately. If the pointer is non-NULL we return
|
||||||
|
* immediately. If the API is blocking and we get a NULL we check the errno
|
||||||
|
* and *only* if that is EAGAIN we loop and wait for socket action.
|
||||||
|
*/
|
||||||
#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
|
#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
|
||||||
do { \
|
do { \
|
||||||
int rc; \
|
int rc; \
|
||||||
ptr = x; \
|
ptr = x; \
|
||||||
if(!sess->api_block_mode || \
|
if(!sess->api_block_mode || \
|
||||||
|
(ptr != NULL) || \
|
||||||
(libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
|
(libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
|
||||||
break; \
|
break; \
|
||||||
rc = _libssh2_wait_socket(sess); \
|
rc = _libssh2_wait_socket(sess); \
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user