[Initng-svn] r3202 - initng/trunk/src

svn at initng.thinktux.net svn at initng.thinktux.net
Sun Mar 5 13:54:56 CET 2006


Author: jimmy
Date: Sun Mar  5 13:54:56 2006
New Revision: 3202

Modified:
   initng/trunk/src/initng_fd.c
Log:
Some cleanup, makomk please add some more comments to your code.



Modified: initng/trunk/src/initng_fd.c
==============================================================================
--- initng/trunk/src/initng_fd.c	(original)
+++ initng/trunk/src/initng_fd.c	Sun Mar  5 13:54:56 2006
@@ -160,14 +160,9 @@
 	
 	D_("read_ret = %i\n", read_ret);
         /* make sure read does not return -1 */
-        if (read_ret < 0)
+        if (read_ret <= 0)
             break;
 
-	if(read_ret == 0)
-	{
-	    is_eof = TRUE; break;
-	}
-	    
 	/* make sure its nulled at end */
 	read_pos[read_ret]='\0';
     
@@ -184,18 +179,16 @@
         initng_fd_plugin_readpipe(service, p, p->buffer + old_content_offset);
     }
 
-    if (is_eof)
+    /* if EOF close pipes */
+    if (read_ret == 0)
     {
-	D_("Freeing buffer for %s\n", service->name);
+	D_("Closing fifos for %s.\n", service->name);
 	if (p->out_pipe[0] > 0)
 	    close(p->out_pipe[0]);
 	if (p->out_pipe[1] > 0)
 	    close(p->out_pipe[1]);
-	if (p->buffer)
-	    free(p->buffer);
 	p->out_pipe[0] = -1;
 	p->out_pipe[1] = -1;
-	p->buffer = NULL;
 	return;
     }
     
@@ -338,7 +331,6 @@
     qC = NULL;
     while_list_safe(currentC, &g.FDWATCHERS, qC)
     {
-        int fd = currentC->c.fdh->fds;
         if (currentC->c.fdh->fds <= 2)
             continue;
         if (!currentC->c.fdh->call_module)
@@ -348,8 +340,8 @@
 
         D_("Calling plugin handler for fd #%i\n", currentC->c.fdh->fds);
         (*currentC->c.fdh->call_module) (currentC->c.fdh);
-        D_("plugin handler for fd #%i returned!\n", fd);
-
+	D_("Call handler returned.\n");
+	
         /* Found match, that means we need to look for one less, if we've found all we should then return */
         retval--;
         if (retval == 0)


More information about the Initng-svn mailing list