You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <co...@decus.org> on 1997/10/17 04:52:12 UTC
[PATCH] Slight cleanup of logging of bad directives
In doing some testing, I got offended by some of the artifactual
errno stuff reported when the config parser encountered a bogus
directive. Due to the call tree, though, it isn't safe to remove
the errno stuff from the error logging, so instead I just force
errno to "invalid argument" in this particular case.
Also a wee bit of cleanup.. if this gets voted in, there'll be a
*lot* of indent changes on this due to TABs. I know you prefer TABs
to spaces, Dean, but the style guide calls for spaces. Go ahead and
re-open that can of wrigglies if you like, but in the meantime
*every*one should be trying to comply, regardless of their personal
preferences..
#ken P-)}
Index: main/http_config.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
retrieving revision 1.81
diff -u -b -r1.81 http_config.c
--- http_config.c 1997/10/07 19:33:58 1.81
+++ http_config.c 1997/10/17 02:51:24
@@ -803,7 +803,9 @@
do {
if (!(cmd = find_command_in_modules(cmd_name, &mod))) {
- return pstrcat(parms->pool, "Invalid command ", cmd_name, NULL);
+ errno = EINVAL;
+ return pstrcat(parms->pool, "Invalid command '", cmd_name, "'",
+ NULL);
}
else {
void *mconfig = get_module_config(config, mod);
@@ -835,9 +837,10 @@
while (!(cfg_getline(l, MAX_STRING_LEN, parms->infile))) {
const char *errmsg = handle_command(parms, config, l);
- if (errmsg)
+ if (errmsg) {
return errmsg;
}
+ }
return NULL;
}
@@ -991,8 +994,9 @@
pfclose(r->pool, f);
if (errmsg) {
- aplog_error(APLOG_MARK, APLOG_ALERT, r->server, "%s: %s", filename, errmsg);
- return SERVER_ERROR;
+ aplog_error(APLOG_MARK, APLOG_ALERT, r->server, "%s: %s",
+ filename, errmsg);
+ return HTTP_INTERNAL_SERVER_ERROR;
}
*result = dc;
Re: [PATCH] Slight cleanup of logging of bad directives
Posted by Dean Gaudet <dg...@arctic.org>.
+1 on fixing the errno stuff. Don't care about the tab changes, as long
as you do it in two separate commits so that we can see what really
changed.
Dean
On Thu, 16 Oct 1997, Rodent of Unusual Size wrote:
> In doing some testing, I got offended by some of the artifactual
> errno stuff reported when the config parser encountered a bogus
> directive. Due to the call tree, though, it isn't safe to remove
> the errno stuff from the error logging, so instead I just force
> errno to "invalid argument" in this particular case.
>
> Also a wee bit of cleanup.. if this gets voted in, there'll be a
> *lot* of indent changes on this due to TABs. I know you prefer TABs
> to spaces, Dean, but the style guide calls for spaces. Go ahead and
> re-open that can of wrigglies if you like, but in the meantime
> *every*one should be trying to comply, regardless of their personal
> preferences..
>
> #ken P-)}
>
> Index: main/http_config.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
> retrieving revision 1.81
> diff -u -b -r1.81 http_config.c
> --- http_config.c 1997/10/07 19:33:58 1.81
> +++ http_config.c 1997/10/17 02:51:24
> @@ -803,7 +803,9 @@
>
> do {
> if (!(cmd = find_command_in_modules(cmd_name, &mod))) {
> - return pstrcat(parms->pool, "Invalid command ", cmd_name, NULL);
> + errno = EINVAL;
> + return pstrcat(parms->pool, "Invalid command '", cmd_name, "'",
> + NULL);
> }
> else {
> void *mconfig = get_module_config(config, mod);
> @@ -835,9 +837,10 @@
>
> while (!(cfg_getline(l, MAX_STRING_LEN, parms->infile))) {
> const char *errmsg = handle_command(parms, config, l);
> - if (errmsg)
> + if (errmsg) {
> return errmsg;
> }
> + }
>
> return NULL;
> }
> @@ -991,8 +994,9 @@
> pfclose(r->pool, f);
>
> if (errmsg) {
> - aplog_error(APLOG_MARK, APLOG_ALERT, r->server, "%s: %s", filename, errmsg);
> - return SERVER_ERROR;
> + aplog_error(APLOG_MARK, APLOG_ALERT, r->server, "%s: %s",
> + filename, errmsg);
> + return HTTP_INTERNAL_SERVER_ERROR;
> }
>
> *result = dc;
>