[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/icecream/icecream/daemon
From:       Michael Matz <matz () kde ! org>
Date:       2004-08-12 15:42:32
Message-ID: 20040812154232.D147399E2 () office ! kde ! org
[Download RAW message or body]

CVS commit by matz: 

0 is a valid fd.


  M +5 -5      main.cpp   1.86
  M +5 -5      serve.cpp   1.50


--- kdenonbeta/icecream/icecream/daemon/main.cpp  #1.85:1.86
@@ -437,12 +437,12 @@ int main( int argc, char ** argv )
       trace() << *it << endl;
 
-    int listen_fd = 0;
+    int listen_fd = -1;
     int tosleep = 0;
 
     while ( 1 ) {
-        if ( listen_fd ) {
+        if ( listen_fd > -1 ) {
             // as long as we have no scheduler, don't listen for clients
             close( listen_fd );
-            listen_fd = 0;
+            listen_fd = -1;
         }
 
@@ -494,5 +494,5 @@ int main( int argc, char ** argv )
                 requests.pop();
                 CompileJob *job = req.first;
-                int sock = 0;
+                int sock = -1;
                 pid_t pid = -1;
 
@@ -519,5 +519,5 @@ int main( int argc, char ** argv )
                     jobmap[pid] = new JobDoneMsg;
                     jobmap[pid]->job_id = job->jobID();
-                    if ( sock )
+                    if ( sock > -1 )
                         pidmap[pid] = sock;
                 }

--- kdenonbeta/icecream/icecream/daemon/serve.cpp  #1.49:1.50
@@ -107,5 +107,5 @@ int handle_connection( const string &bas
     int ti = 0; // the socket
     unsigned int job_id = 0;
-    int obj_fd = 0; // the obj_fd
+    int obj_fd = -1; // the obj_fd
     string obj_file;
 
@@ -204,5 +204,5 @@ int handle_connection( const string &bas
     }
     close( ti );
-    ti = 0;
+    ti = -1;
 
     struct timeval begintv;
@@ -285,8 +285,8 @@ int handle_connection( const string &bas
             unlink( tmp_input );
 
-        if ( ti )
+        if ( ti > -1 )
             close( ti );
 
-        if ( obj_fd > 0)
+        if ( obj_fd > -1)
             close( obj_fd );
 
@@ -294,5 +294,5 @@ int handle_connection( const string &bas
             unlink( obj_file.c_str() );
 
-        if ( out_fd )
+        if ( out_fd > -1)
             close( out_fd );
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic