Index: src/session.c
===================================================================
--- src/session.c.orig	2007-04-18 02:02:26.000000000 +0000
+++ src/session.c	2007-04-26 18:29:58.746793000 +0000
@@ -738,7 +738,7 @@
 	unsigned int i, active_fds;
 #ifdef HAVE_POLL
 	LIBSSH2_SESSION *session = NULL;
-	struct pollfd sockets[nfds];
+	struct pollfd * sockets = malloc(nfds * sizeof(struct pollfd));
 	/* FIXME: (dast) this is not C89 code! However, the prototype for this
 	   function doesn't provide a session struct so we can't easily use
 	   the user-provided malloc replacement here... I suggest we modify
@@ -770,6 +770,7 @@
 				return -1;
 		}
 	}
+	free(sockets);
 #elif defined(HAVE_SELECT)
 	LIBSSH2_SESSION *session = NULL;
 	int maxfd = 0;
Index: example/simple/scp_nonblock.c
===================================================================
--- example/simple/scp_nonblock.c.orig	2007-02-02 16:21:20.000000000 +0000
+++ example/simple/scp_nonblock.c	2007-04-26 18:29:58.804400000 +0000
@@ -10,6 +10,7 @@
 # include <netinet/in.h>
 # include <sys/socket.h>
 # include <unistd.h>
+# include <sys/time.h>
 #else
 # include <winsock2.h>
 #endif
Index: example/simple/sftp_nonblock.c
===================================================================
--- example/simple/sftp_nonblock.c.orig	2007-04-23 02:02:14.000000000 +0000
+++ example/simple/sftp_nonblock.c	2007-04-26 18:31:06.373781000 +0000
@@ -17,6 +17,7 @@
 # include <sys/socket.h>
 # include <unistd.h>
 # include <arpa/inet.h>
+# include <sys/time.h>
 #else
 # include <winsock2.h>
 #endif
Index: example/simple/sftp_RW_nonblock.c
===================================================================
--- example/simple/sftp_RW_nonblock.c.orig	2007-04-22 14:15:47.000000000 +0000
+++ example/simple/sftp_RW_nonblock.c	2007-04-26 21:56:13.467658000 +0000
@@ -16,6 +16,7 @@
 # include <netinet/in.h>
 # include <sys/socket.h>
 # include <unistd.h>
+# include <sys/time.h>
 #else
 # include <winsock2.h>
 #endif

