From 013893c86a0fd17a28c771423f1a8e2f021ce3b6 Mon Sep 17 00:00:00 2001
From: Fons Rademakers <Fons.Rademakers@cern.ch>
Date: Mon, 5 Feb 2007 16:07:00 +0000
Subject: [PATCH] initialize fmaxrfd and fmaxwfd to -1 (0 is a valid socket id)
 and check for them to be -1 to do nothing (and not 0).

git-svn-id: http://root.cern.ch/svn/root/trunk@17698 27541ba8-7e3a-0410-8455-c3a389f83636
---
 base/src/TSystem.cxx     |  6 +++---
 unix/src/TUnixSystem.cxx | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/base/src/TSystem.cxx b/base/src/TSystem.cxx
index 88835221aee..6bb1ea7b8dd 100644
--- a/base/src/TSystem.cxx
+++ b/base/src/TSystem.cxx
@@ -1,4 +1,4 @@
-// @(#)root/base:$Name:  $:$Id: TSystem.cxx,v 1.151 2006/11/28 14:03:48 rdm Exp $
+// @(#)root/base:$Name:  $:$Id: TSystem.cxx,v 1.152 2006/12/06 10:20:06 rdm Exp $
 // Author: Fons Rademakers   15/09/95
 
 /*************************************************************************
@@ -155,8 +155,8 @@ Bool_t TSystem::Init()
    // Initialize the OS interface.
 
    fNfd    = 0;
-   fMaxrfd = 0;
-   fMaxwfd = 0;
+   fMaxrfd = -1;
+   fMaxwfd = -1;
 
    fSigcnt = 0;
    fLevel  = 0;
diff --git a/unix/src/TUnixSystem.cxx b/unix/src/TUnixSystem.cxx
index f36a9e3a919..65473402baa 100644
--- a/unix/src/TUnixSystem.cxx
+++ b/unix/src/TUnixSystem.cxx
@@ -1,4 +1,4 @@
-// @(#)root/unix:$Name:  $:$Id: TUnixSystem.cxx,v 1.179 2007/02/05 09:41:09 rdm Exp $
+// @(#)root/unix:$Name:  $:$Id: TUnixSystem.cxx,v 1.180 2007/02/05 10:38:04 rdm Exp $
 // Author: Fons Rademakers   15/09/95
 
 /*************************************************************************
@@ -529,8 +529,8 @@ TFileHandler *TUnixSystem::RemoveFileHandler(TFileHandler *h)
    if (oh) {       // found
       TFileHandler *th;
       TIter next(fFileHandler);
-      fMaxrfd = 0;
-      fMaxwfd = 0;
+      fMaxrfd = -1;
+      fMaxwfd = -1;
       fReadmask->Zero();
       fWritemask->Zero();
       while ((th = (TFileHandler *) next())) {
@@ -790,10 +790,10 @@ void TUnixSystem::DispatchOneEvent(Bool_t pendingOnly)
       *fWriteready = *fWritemask;
 
       int mxfd = TMath::Max(fMaxrfd, fMaxwfd);
-      if (mxfd) mxfd++;
+      if (mxfd > -1) mxfd++;
 
       // if nothing to select (socket or timer) return
-      if (mxfd == 0 && nextto == -1)
+      if (mxfd == -1 && nextto == -1)
          return;
 
       fNfd = UnixSelect(mxfd, fReadready, fWriteready, nextto);
-- 
GitLab