httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: 1.0 release sources and the Binary release
Date Sat, 02 Dec 1995 16:35:53 GMT
> 
> > It has bugs (however, I back the principle):
> > 
> 
> > > ***************
> > > *** 156,161 ****
> > > --- 156,163 ----
> > >   
> > >       for (r = orig; r->next; r = r->next)
> > >           continue;
> > > +     if (cls->fname == "")	/* Don't log agent */
> >                        ^^^^^ Oooops!
> > > + 	return DECLINED;
> 
> Not sure I understand why this is wrong. It is a comparision
> and not an assignment. The cls->fname is initialized to "".
> Splain me please.

OK, mortar board on:

"" means "the address of a chunk of memory with a null string in". This is
not necessarily equal to the address of another chunk of memory with a null
string in. In fact, it really shouldn't be equal (but some optimizers will
make them the same).

The correct test is *cls->fname == '\0', or !*cls->fname.

Cheers,

Ben.

> 
> 
> > >       if (cls->log_fd > 0) return; 
> > > !     if(*cls->fname != NULL) {
> > 
> > This construction is, strictly, wrong (though it usually works). It irritates
> > me to see it, the correct thing to say is:
> > 
> >      if(*cls->fname != '\0') {
> > 
> > I know this appears all over the place. Its one of the things I intend to fix
> > post-1.0.0.
> > 
> > > !       if((cls->log_fd = popenf(p, fname, cookie_flags, cookie_mode)) <
0) 
> 
> Agreed. I should know better since I have fixed this problem many times
> on other projects and other compilers.
> 
> 
> 

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message