summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:09 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:09 +0000
commit0a8a80e58374771acc225fe1e08ed8e0fe0016cc (patch)
treeafa40f2a73b369e2ba930e47c961992170a669b7 /apt-pkg/contrib/fileutl.cc
parent93641593cafac296b9072288d8ef9e1a526d745b (diff)
Sync
Author: jgg Date: 1998-10-22 04:56:38 GMT Sync
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index bfc674c62..3d5c4686b 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.10 1998/10/20 04:33:16 jgg Exp $
+// $Id: fileutl.cc,v 1.11 1998/10/22 04:56:47 jgg Exp $
/* ######################################################################
File Utilities
@@ -136,8 +136,8 @@ void SetCloseExec(int Fd,bool Close)
/* */
void SetNonBlock(int Fd,bool Block)
{
- int Flags = fcntl(Fd,F_GETFL);
- if (fcntl(Fd,F_SETFL,(Flags & ~O_NONBLOCK) | (Block == false)?0:O_NONBLOCK) != 0)
+ int Flags = fcntl(Fd,F_GETFL) & (~O_NONBLOCK);
+ if (fcntl(Fd,F_SETFL,Flags | ((Block == false)?0:O_NONBLOCK)) != 0)
{
cerr << "FATAL -> Could not set non-blocking flag " << strerror(errno) << endl;
exit(100);
@@ -153,8 +153,10 @@ bool WaitFd(int Fd)
fd_set Set;
FD_ZERO(&Set);
FD_SET(Fd,&Set);
+
if (select(Fd+1,&Set,0,0,0) <= 0)
return false;
+
return true;
}
/*}}}*/