summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-03-12 16:24:56 +0100
committerAnatol Belski <ab@php.net>2015-03-12 16:24:56 +0100
commit1cf70266e77cf5810f46a3282b03e7ae0f45c23a (patch)
tree73c04c1edd76fde1a5e7bd84973e0170dbedfe78
parent931f116bbdf2e83ee23245fff069527584026bd5 (diff)
downloadphp-git-1cf70266e77cf5810f46a3282b03e7ae0f45c23a.tar.gz
use _set_errno where appropriate
-rw-r--r--ext/ftp/ftp.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c
index 970ba8f387..9c0c921565 100644
--- a/ext/ftp/ftp.c
+++ b/ext/ftp/ftp.c
@@ -1262,8 +1262,11 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
n = php_pollfd_for_ms(s, POLLOUT, ftp->timeout_sec * 1000);
if (n < 1) {
-
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
+#ifdef PHP_WIN32
+ if (n == 0) {
+ _set_errno(ETIMEDOUT);
+ }
+#elif !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0) {
errno = ETIMEDOUT;
}
@@ -1303,7 +1306,11 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
+#ifdef PHP_WIN32
+ if (n == 0) {
+ _set_errno(ETIMEDOUT);
+ }
+#elif !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0) {
errno = ETIMEDOUT;
}
@@ -1335,7 +1342,11 @@ data_available(ftpbuf_t *ftp, php_socket_t s)
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, 1000);
if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
+#ifdef PHP_WIN32
+ if (n == 0) {
+ _set_errno(ETIMEDOUT);
+ }
+#elif !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0) {
errno = ETIMEDOUT;
}
@@ -1355,7 +1366,11 @@ data_writeable(ftpbuf_t *ftp, php_socket_t s)
n = php_pollfd_for_ms(s, POLLOUT, 1000);
if (n < 1) {
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+ if (n == 0) {
+ _set_errno(ETIMEDOUT);
+ }
+#elif !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0) {
errno = ETIMEDOUT;
}
@@ -1376,7 +1391,11 @@ my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrl
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
if (n < 1) {
-#if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK))
+#ifdef PHP_WIN32
+ if (n == 0) {
+ _set_errno(ETIMEDOUT);
+ }
+#elif !(defined(NETWARE) && defined(USE_WINSOCK))
if (n == 0) {
errno = ETIMEDOUT;
}