aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cynapses.org>2010-06-17 13:25:45 +0200
committerAndreas Schneider <asn@cynapses.org>2010-06-17 13:35:40 +0200
commit4c679fd8a640b841609a40bb4d13a49b3f85d87a (patch)
tree2905c25b18f1f04c5d15fd0b1092ad5b6afc88c8
parent21d918c68aab56111df7dee7879a6b21427b7a2f (diff)
downloadlibssh-4c679fd8a640b841609a40bb4d13a49b3f85d87a.tar.gz
libssh-4c679fd8a640b841609a40bb4d13a49b3f85d87a.tar.xz
libssh-4c679fd8a640b841609a40bb4d13a49b3f85d87a.zip
poll: Fixed type of the fd variables and use SSH_INVALID_SOCKET.
-rw-r--r--include/libssh/poll.h2
-rw-r--r--libssh/poll.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/include/libssh/poll.h b/include/libssh/poll.h
index b9e6494a..d3a744f3 100644
--- a/include/libssh/poll.h
+++ b/include/libssh/poll.h
@@ -92,7 +92,7 @@ typedef struct ssh_poll_handle_struct *ssh_poll_handle;
* @return 0 on success, < 0 if you removed the poll object from
* it's poll context.
*/
-typedef int (*ssh_poll_callback)(ssh_poll_handle p, int fd, int revents,
+typedef int (*ssh_poll_callback)(ssh_poll_handle p, socket_t fd, int revents,
void *userdata);
diff --git a/libssh/poll.c b/libssh/poll.c
index cac4c4d6..2b7096b0 100644
--- a/libssh/poll.c
+++ b/libssh/poll.c
@@ -111,7 +111,7 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
/* compute fd_sets and find largest descriptor */
for (max_fd = 0, i = 0; i < nfds; i++) {
- if (fds[i].fd == (socket_t) -1) {
+ if (fds[i].fd == SSH_INVALID_SOCKET) {
continue;
}
@@ -132,7 +132,7 @@ static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) {
}
}
- if (max_fd == (socket_t) -1) {
+ if (max_fd == SSH_INVALID_SOCKET) {
errno = EINVAL;
return -1;
}
@@ -391,7 +391,7 @@ void ssh_poll_ctx_free(ssh_poll_ctx ctx) {
used = ctx->polls_used;
for (i = 0; i < used; ) {
ssh_poll_handle p = ctx->pollptrs[i];
- int fd = ctx->pollfds[i].fd;
+ socket_t fd = ctx->pollfds[i].fd;
/* force poll object removal */
if (p->cb(p, fd, POLLERR, p->cb_data) < 0) {
@@ -439,7 +439,7 @@ static int ssh_poll_ctx_resize(ssh_poll_ctx ctx, size_t new_size) {
* @return 0 on success, < 0 on error
*/
int ssh_poll_ctx_add(ssh_poll_ctx ctx, ssh_poll_handle p) {
- int fd;
+ socket_t fd;
if (p->ctx != NULL) {
/* already attached to a context */
@@ -518,7 +518,7 @@ int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) {
i++;
} else {
ssh_poll_handle p = ctx->pollptrs[i];
- int fd = ctx->pollfds[i].fd;
+ socket_t fd = ctx->pollfds[i].fd;
int revents = ctx->pollfds[i].revents;
if (p->cb(p, fd, revents, p->cb_data) < 0) {