Download raw body.
httpd: remove debug-only ps variable alias
On 2026/07/28 08:06, Rafael Sadowski wrote:
> OK?
any particular reason? imho the DPRINTFs are easier-reading if it's kept..
> diff --git a/config.c b/config.c
> index ecaa59a..411cf6b 100644
> --- a/config.c
> +++ b/config.c
> @@ -610,9 +610,6 @@ int
> config_getserver_config(struct httpd *env, struct server *srv,
> struct imsg *imsg)
> {
> -#ifdef DEBUG
> - struct privsep *ps = env->sc_ps;
> -#endif
> struct server_config *srv_conf, *parent;
> uint8_t *p = imsg->data;
> uint64_t f;
> @@ -770,15 +767,16 @@ config_getserver_config(struct httpd *env, struct server *srv,
>
> DPRINTF("%s: %s %d location \"%s\", "
> "parent \"%s[%u]\", flags: %s",
> - __func__, ps->ps_title[privsep_process], ps->ps_instance,
> - srv_conf->location, parent->name, parent->id,
> - printb_flags(srv_conf->flags, SRVFLAG_BITS));
> + __func__, env->sc_ps->ps_title[privsep_process],
> + env->sc_ps->ps_instance, srv_conf->location, parent->name,
> + parent->id, printb_flags(srv_conf->flags, SRVFLAG_BITS));
> } else {
> /* Add a new "virtual" server */
> DPRINTF("%s: %s %d server \"%s[%u]\", parent \"%s[%u]\", "
> "flags: %s", __func__,
> - ps->ps_title[privsep_process], ps->ps_instance,
> - srv_conf->name, srv_conf->id, parent->name, parent->id,
> + env->sc_ps->ps_title[privsep_process],
> + env->sc_ps->ps_instance, srv_conf->name, srv_conf->id,
> + parent->name, parent->id,
> printb_flags(srv_conf->flags, SRVFLAG_BITS));
> }
>
> @@ -795,9 +793,6 @@ config_getserver_config(struct httpd *env, struct server *srv,
> int
> config_getserver(struct httpd *env, struct imsg *imsg)
> {
> -#ifdef DEBUG
> - struct privsep *ps = env->sc_ps;
> -#endif
> struct server *srv = NULL;
> struct server_config srv_conf;
> uint8_t *p = imsg->data;
> @@ -863,7 +858,7 @@ config_getserver(struct httpd *env, struct imsg *imsg)
> TAILQ_INSERT_TAIL(env->sc_servers, srv, srv_entry);
>
> DPRINTF("%s: %s %d configuration \"%s[%u]\", flags: %s", __func__,
> - ps->ps_title[privsep_process], ps->ps_instance,
> + env->sc_ps->ps_title[privsep_process], env->sc_ps->ps_instance,
> srv->srv_conf.name, srv->srv_conf.id,
> printb_flags(srv->srv_conf.flags, SRVFLAG_BITS));
>
> @@ -884,14 +879,10 @@ config_gettls(struct httpd *env, struct server_config *srv_conf,
> struct tls_config *tls_conf, const char *label, uint8_t *data, size_t len,
> uint8_t **outdata, size_t *outlen)
> {
> -#ifdef DEBUG
> - struct privsep *ps = env->sc_ps;
> -#endif
> -
> DPRINTF("%s: %s %d getting tls %s (%zu:%zu@%zu) for \"%s[%u]\"",
> - __func__, ps->ps_title[privsep_process], ps->ps_instance, label,
> - tls_conf->tls_len, len, tls_conf->tls_chunk_offset, srv_conf->name,
> - srv_conf->id);
> + __func__, env->sc_ps->ps_title[privsep_process],
> + env->sc_ps->ps_instance, label, tls_conf->tls_len, len,
> + tls_conf->tls_chunk_offset, srv_conf->name, srv_conf->id);
>
> if (tls_conf->tls_chunk_offset == 0) {
> free(*outdata);
> @@ -1025,9 +1016,6 @@ config_setmedia(struct httpd *env, struct media_type *media)
> int
> config_getmedia(struct httpd *env, struct imsg *imsg)
> {
> -#ifdef DEBUG
> - struct privsep *ps = env->sc_ps;
> -#endif
> struct media_type media;
> uint8_t *p = imsg->data;
>
> @@ -1041,7 +1029,7 @@ config_getmedia(struct httpd *env, struct imsg *imsg)
> }
>
> DPRINTF("%s: %s %d received media \"%s\"", __func__,
> - ps->ps_title[privsep_process], ps->ps_instance,
> + env->sc_ps->ps_title[privsep_process], env->sc_ps->ps_instance,
> media.media_name);
>
> return (0);
> @@ -1081,9 +1069,6 @@ config_setauth(struct httpd *env, struct auth *auth)
> int
> config_getauth(struct httpd *env, struct imsg *imsg)
> {
> -#ifdef DEBUG
> - struct privsep *ps = env->sc_ps;
> -#endif
> struct auth auth;
> uint8_t *p = imsg->data;
>
> @@ -1097,7 +1082,7 @@ config_getauth(struct httpd *env, struct imsg *imsg)
> }
>
> DPRINTF("%s: %s %d received auth \"%s[%u]\"", __func__,
> - ps->ps_title[privsep_process], ps->ps_instance,
> + env->sc_ps->ps_title[privsep_process], env->sc_ps->ps_instance,
> auth.auth_htpasswd, auth.auth_id);
>
> return (0);
>
httpd: remove debug-only ps variable alias