*
* Usage: echod -h give all info
*
- * $Id: poll_echod.c,v 1.1 2004/01/02 21:32:08 piccardi Exp $
+ * $Id: poll_echod.c,v 1.2 2004/01/05 19:24:52 piccardi Exp $
*
****************************************************************/
/*
* Include needed headers
*/
+#define _XOPEN_SOURCE
#include <limits.h> /* system limits */
#include <sys/types.h> /* predefined types */
#include <unistd.h> /* include unix standard library */
#include <errno.h> /* error code */
#include <string.h> /* error strings */
#include <stdlib.h>
-#define _XOPEN_SOURCE
#include <sys/poll.h> /* poll function definition */
#include "macros.h"
poll_set[max_fd].fd = list_fd;
/* main loop, wait for connection and data inside a select */
while (1) {
- while ( ((n = poll(poll_set, max_fd, -1)) < 0)
+ while ( ((n = poll(poll_set, max_fd + 1, -1)) < 0)
&& (errno == EINTR)); /* wait for data or connection */
if (n < 0) { /* on real error exit */
PrintErr("poll error");