cppcheck finds some unread assignments in httpd's config.c

The patch below deletes them and the resulting unused variables.  By way of
[a bit more] context, the last of these is:

   682          if (srv->srv_conf.return_uri_len != 0) {
   683                  if ((srv->srv_conf.return_uri = get_data(p + s,
   684                      srv->srv_conf.return_uri_len)) == NULL)
   685                          goto fail;
   686                  s += srv->srv_conf.return_uri_len;
   687          }
   688  
   689          return (0);
   690  
   691   fail:

Ross

===================================================================
RCS file: /cvs/src/usr.sbin/httpd/config.c,v
retrieving revision 1.57
diff -u -p -r1.57 config.c
--- config.c    8 May 2019 19:57:45 -0000       1.57
+++ config.c    2 Aug 2020 11:12:28 -0000
@@ -135,9 +135,7 @@ config_getreset(struct httpd *env, struc
 int
 config_getcfg(struct httpd *env, struct imsg *imsg)
 {
-       struct privsep          *ps = env->sc_ps;
        struct ctl_flags         cf;
-       unsigned int             what;
 
        if (IMSG_DATA_SIZE(imsg) != sizeof(cf))
                return (0); /* ignore */
@@ -148,8 +146,6 @@ config_getcfg(struct httpd *env, struct 
        env->sc_flags = cf.cf_flags;
        memcpy(env->sc_tls_sid, cf.cf_tls_sid, sizeof(env->sc_tls_sid));
 
-       what = ps->ps_what[privsep_process];
-
        if (privsep_process != PROC_PARENT)
                proc_compose(env->sc_ps, PROC_PARENT,
                    IMSG_CFG_DONE, NULL, 0);
@@ -683,7 +679,6 @@ config_getserver(struct httpd *env, stru
                if ((srv->srv_conf.return_uri = get_data(p + s,
                    srv->srv_conf.return_uri_len)) == NULL)
                        goto fail;
-               s += srv->srv_conf.return_uri_len;
        }
 
        return (0);

Reply via email to