From 72438f2e746390d9d1f4f12d8db3d55554530023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Fri, 10 Jul 1998 20:58:55 +0200 Subject: [PATCH] Made file_peek() somewhat more paranoid. Rev: src/modules/files/file.c:1.109 --- src/modules/files/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/files/file.c b/src/modules/files/file.c index fee7a5a3c2..e58c9f0189 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -5,7 +5,7 @@ \*/ #include "global.h" -RCSID("$Id: file.c,v 1.108 1998/07/09 01:56:35 hubbe Exp $"); +RCSID("$Id: file.c,v 1.109 1998/07/10 18:58:55 grubba Exp $"); #include "fdlib.h" #include "interpret.h" #include "svalue.h" @@ -679,7 +679,7 @@ static void file_peek(INT32 args) fds.revents=0; THREADS_ALLOW(); - ret=poll(&fds, 1, 0); + ret=poll(&fds, 1, 1); THREADS_DISALLOW(); if(ret < 0) @@ -687,14 +687,14 @@ static void file_peek(INT32 args) ERRNO=errno; ret=-1; }else{ - ret = ret>=0 && (fds.revents & POLLIN); + ret = (ret > 0) && (fds.revents & POLLIN); } #else int ret; fd_set tmp; struct timeval tv; - tv.tv_usec=0; + tv.tv_usec=1; tv.tv_sec=0; fd_FD_ZERO(&tmp); fd_FD_SET(ret=THIS->fd, &tmp); @@ -708,7 +708,7 @@ static void file_peek(INT32 args) ERRNO=errno; ret=-1; }else{ - ret= ret>0 && fd_FD_ISSET(THIS->fd, &tmp); + ret = (ret > 0) && fd_FD_ISSET(THIS->fd, &tmp); } #endif pop_n_elems(args); -- GitLab