You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/06/29 01:20:45 UTC
Re: cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
On Sat, 28 Jun 1997, Dean Gaudet wrote:
> ***************
> *** 970,975 ****
> --- 970,980 ----
> return NULL;
> }
>
> + const char *set_lockfile (cmd_parms *cmd, void *dummy, char *arg) {
> + lock_fname = pstrdup (cmd->pool, arg);
> + return NULL;
> + }
> +
This code should check to see if it is in a virtual server and whine if
so.
> #endif
> #endif /* WIN32 */
>
> + #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT)
> + static void expand_lock_fname(pool *p)
> + {
> + char buf[20];
> +
> + ap_snprintf( buf, sizeof(buf)-1, ".%u", getpid() );
> + buf[sizeof(buf)-1] = 0;
This should be '\0', not 0.
Re: cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
Posted by Dean Gaudet <dg...@arctic.org>.
On Sat, 28 Jun 1997, Marc Slemko wrote:
> No they aren't. They _DO_ the same thing but they aren't the same thing.
>
> Would it be valid to put NULL there? No. Is it valid to put 0 there?
> Not IMHO.
ANSI says that 0 and NULL are interchangeable for pointers. In fact
"#define NULL (0)" is a correct definition of NULL. Most system choose to
make it ((void *)0) to open up error reporting opportunities.
'\0' == ((char)0) by definition of \octal. And the lvalue casting rules
make char x = 0 the same as char x = '\0'.
I could be talking out of my butt though ;)
> But in any case, I am about to remove that line entirely because it is
> bogus; snprintf always null terminates a string anyway. Good way to solve
> a problem. <g>
phfffft!
Dean
Re: cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
Posted by Marc Slemko <ma...@worldgate.com>.
On Sat, 28 Jun 1997, Dean Gaudet wrote:
> > > #endif
> > > #endif /* WIN32 */
> > >
> > > + #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT)
> > > + static void expand_lock_fname(pool *p)
> > > + {
> > > + char buf[20];
> > > +
> > > + ap_snprintf( buf, sizeof(buf)-1, ".%u", getpid() );
> > > + buf[sizeof(buf)-1] = 0;
> >
> > This should be '\0', not 0.
>
> They're the same thing.
>
No they aren't. They _DO_ the same thing but they aren't the same thing.
Would it be valid to put NULL there? No. Is it valid to put 0 there?
Not IMHO.
But in any case, I am about to remove that line entirely because it is
bogus; snprintf always null terminates a string anyway. Good way to solve
a problem. <g>
Re: cvs commit: apache/src http_conf_globals.h http_config.c http_core.c http_main.c httpd.h
Posted by Dean Gaudet <dg...@arctic.org>.
On Sat, 28 Jun 1997, Marc Slemko wrote:
> On Sat, 28 Jun 1997, Dean Gaudet wrote:
>
> > ***************
> > *** 970,975 ****
> > --- 970,980 ----
> > return NULL;
> > }
> >
> > + const char *set_lockfile (cmd_parms *cmd, void *dummy, char *arg) {
> > + lock_fname = pstrdup (cmd->pool, arg);
> > + return NULL;
> > + }
> > +
>
> This code should check to see if it is in a virtual server and whine if
> so.
Yep. But I think I'm done for today.
>
> > #endif
> > #endif /* WIN32 */
> >
> > + #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT)
> > + static void expand_lock_fname(pool *p)
> > + {
> > + char buf[20];
> > +
> > + ap_snprintf( buf, sizeof(buf)-1, ".%u", getpid() );
> > + buf[sizeof(buf)-1] = 0;
>
> This should be '\0', not 0.
They're the same thing.
Dean