[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for correcting some more "discards qualifiers warning" in httpd



I corrected some warning in compiling httpd. I got the idea to look for 
some more from the PR 5014 closed a few days ago.

Hopefully it will be good to include as is. See the attach patch for it.

So, the error comes from ap_server_strip_chroot() that eventually 
modifies the first argument, so passing a const char * to it shouldn't 
be done or you get warnings as below:

mod_auth_digest.c: In function `set_digest_file':
mod_auth_digest.c:327: warning: passing arg 1 of 
`ap_server_strip_chroot' discards qualifiers from pointer target type
mod_auth_digest.c: In function `set_group_file':
mod_auth_digest.c:335: warning: passing arg 1 of 
`ap_server_strip_chroot' discards qualifiers from pointer target type
mod_so.c: In function `load_module':
mod_so.c:242: warning: passing arg 1 of `ap_server_strip_chroot' 
discards qualifiers from pointer target type
mod_auth_db.c: In function `get_db_pw':
mod_auth_db.c:176: warning: passing arg 1 of `ap_server_strip_chroot' 
discards qualifiers from pointer target type
mod_proxy.c: In function `set_cache_root':
mod_proxy.c:778: warning: passing arg 1 of `ap_server_strip_chroot' 
discards qualifiers from pointer target type

Hope this help some anyway.

Daniel
Index: src/modules/experimental/mod_auth_digest.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c,v
retrieving revision 1.19
diff -u -r1.19 mod_auth_digest.c
--- src/modules/experimental/mod_auth_digest.c  9 Feb 2005 12:13:10 -0000       1.19
+++ src/modules/experimental/mod_auth_digest.c  22 Feb 2006 09:11:55 -0000
@@ -324,7 +324,7 @@
                                   const char *file)
 {
     ((digest_config_rec *) config)->pwfile = file;
-    ap_server_strip_chroot(((digest_config_rec *) config)->pwfile, 1);
+    ap_server_strip_chroot((char *) ((digest_config_rec *) config)->pwfile, 1);
     return NULL;
 }

@@ -332,7 +332,7 @@
                                  const char *file)
 {
     ((digest_config_rec *) config)->grpfile = file;
-    ap_server_strip_chroot(((digest_config_rec *) config)->grpfile, 1);
+    ap_server_strip_chroot((char *) ((digest_config_rec *) config)->grpfile, 1);
     return NULL;
 }

Index: src/modules/proxy/mod_proxy.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.14
diff -u -r1.14 mod_proxy.c
--- src/modules/proxy/mod_proxy.c       9 Feb 2005 12:13:10 -0000       1.14
+++ src/modules/proxy/mod_proxy.c       22 Feb 2006 09:11:55 -0000
@@ -775,7 +775,7 @@
     ap_get_module_config(parms->server->module_config, &proxy_module);

     psf->cache.root = arg;
-    ap_server_strip_chroot(psf->cache.root, 1);
+    ap_server_strip_chroot((char *) psf->cache.root, 1);

     return NULL;
 }
Index: src/modules/standard/mod_auth_db.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/standard/mod_auth_db.c,v
retrieving revision 1.12
diff -u -r1.12 mod_auth_db.c
--- src/modules/standard/mod_auth_db.c  21 Aug 2003 13:11:36 -0000      1.12
+++ src/modules/standard/mod_auth_db.c  22 Feb 2006 09:11:55 -0000
@@ -173,7 +173,7 @@
     q.data = user;
     q.size = strlen(q.data);

-    ap_server_strip_chroot(auth_dbpwfile, 1);
+    ap_server_strip_chroot((char *) auth_dbpwfile, 1);

 #if defined(DB3) || defined(DB4)
     if (   db_create(&f, NULL, 0) != 0
Index: src/modules/standard/mod_so.c
===================================================================
RCS file: /cvs/src/usr.sbin/httpd/src/modules/standard/mod_so.c,v
retrieving revision 1.14
diff -u -r1.14 mod_so.c
--- src/modules/standard/mod_so.c       9 Feb 2005 12:13:10 -0000       1.14
+++ src/modules/standard/mod_so.c       22 Feb 2006 09:11:55 -0000
@@ -207,7 +207,7 @@
 {
     ap_os_dso_handle_t modhandle;
     module *modp;
-    const char *szModuleFile=ap_server_root_relative(cmd->pool, filename);
+    char *szModuleFile=ap_server_root_relative(cmd->pool, filename);
     so_server_conf *sconf;
     moduleinfo *modi;
     moduleinfo *modie;