On Thu, Feb 24, 2011 at 10:44:58PM +0000, Kostas Georgiou wrote: > On Thu, Feb 24, 2011 at 12:25:16PM +0000, Carlo Marcelo Arenas Belon wrote: > > > On Wed, Feb 23, 2011 at 09:42:56AM -0800, Bernard Li wrote: > > > > > > 123 read: > > > 124 read_len = read(fd, db, buflen); > > > 125 if (read_len <= 0) > > > 126 { > > > 127 if (errno == EINTR) > > > 128 goto read; > > > 129 err_ret("slurpfile() read() error on file %s", > > > filename); > > > 130 close(fd); > > > 131 return SYNAPSE_FAILURE; > > > 132 } > > > > this code is not relevant as it is only called when EINTR is received > > because a signal interrupts the read call (very unlikely) > > Shouldn't this be "if (read_len < 0)", a return of zero from read is > possible (EOF for example). If slurpfile is called with buffer=NULL and > buffsize equal or a multiple of the file size then we get > SYNAPSE_FAILURE. The errno check will be against an old value of errno > in this which makes it more likely to hit (still very unlikely though :) > and then we have an infinite loop...
good point, eventhough I would like to think that errno will be reset by the read call and avoid the infinite loop anyway. Committed revision 2494 Carlo ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers