"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: fix name clash in gotwebd
To:
gameoftrees@openbsd.org
Date:
Fri, 22 Jul 2022 10:27:26 -0600

Download raw body.

Thread
On Fri, Jul 22, 2022 at 05:30:52PM +0200, Stefan Sperling wrote:
> Rename GOT_PACK_NUM_TEMPFILES in gotwebd, since it clashes with
> a name already used in lib/repository.c.
> 
> ok?

ok

> 
> diff /home/stsp/src/got
> commit - 5e98fb339b4588f8e07c12b9f9ace9dbdcc47592
> path + /home/stsp/src/got
> blob - 4a8874a87e47d8824f253f466514c16f8ce8c881
> file + gotwebd/config.c
> --- gotwebd/config.c
> +++ gotwebd/config.c
> @@ -214,7 +214,7 @@ config_getsock(struct gotwebd *env, struct imsg *imsg)
>  	for (i = 0; i < PRIV_FDS__MAX; i++)
>  		sock->priv_fd[i] = -1;
>  
> -	for (i = 0; i < GOT_PACK_NUM_TEMPFILES; i++)
> +	for (i = 0; i < GOTWEB_PACK_NUM_TEMPFILES; i++)
>  		sock->pack_fds[i] = -1;
>  
>  	/* log new socket info */
> @@ -240,9 +240,9 @@ config_setfd(struct gotwebd *env, struct socket *sock)
>  	unsigned int what;
>  
>  	log_debug("%s: Allocating %d file descriptors",
> -	    __func__, PRIV_FDS__MAX + GOT_PACK_NUM_TEMPFILES);
> +	    __func__, PRIV_FDS__MAX + GOTWEB_PACK_NUM_TEMPFILES);
>  
> -	for (j = 0; j < PRIV_FDS__MAX + GOT_PACK_NUM_TEMPFILES; j++) {
> +	for (j = 0; j < PRIV_FDS__MAX + GOTWEB_PACK_NUM_TEMPFILES; j++) {
>  		for (id = 0; id < PROC_MAX; id++) {
>  			what = ps->ps_what[id];
>  
> @@ -300,7 +300,8 @@ config_getfd(struct gotwebd *env, struct imsg *imsg)
>  	memcpy(&sock_id, p, sizeof(sock_id));
>  
>  	TAILQ_FOREACH(sock, env->sockets, entry) {
> -		for (i = 0; i < (GOT_PACK_NUM_TEMPFILES + PRIV_FDS__MAX); i++) {
> +		const int nfds = (GOTWEB_PACK_NUM_TEMPFILES + PRIV_FDS__MAX);
> +		for (i = 0; i < nfds; i++) {
>  			if (i < PRIV_FDS__MAX && sock->priv_fd[i] == -1) {
>  				log_debug("%s: assigning socket %d priv_fd %d",
>  				    __func__, sock_id, imsg->fd);
> blob - dc7c84efaf6ec6c1ee3babbaf8c49795d4e21dd6
> file + gotwebd/gotwebd.h
> --- gotwebd/gotwebd.h
> +++ gotwebd/gotwebd.h
> @@ -109,8 +109,7 @@
>  #define FCGI_OVERLOADED		2
>  #define FCGI_UNKNOWN_ROLE	3
>  
> -/* XXX: move this later after ig */
> -#define GOT_PACK_NUM_TEMPFILES     32
> +#define GOTWEB_PACK_NUM_TEMPFILES     32
>  
>  enum imsg_type {
>  	IMSG_CFG_SRV = IMSG_PROC_MAX,
> @@ -320,7 +319,7 @@ struct socket {
>  	struct socket_conf	 conf;
>  
>  	int		 fd;
> -	int		 pack_fds[GOT_PACK_NUM_TEMPFILES];
> +	int		 pack_fds[GOTWEB_PACK_NUM_TEMPFILES];
>  	int		 priv_fd[PRIV_FDS__MAX];
>  
>  	struct event	 evt;
> 

-- 

Tracey Emery