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

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: Get rid of (null) on the index page
To:
gameoftrees@openbsd.org
Date:
Tue, 30 Aug 2022 20:46:41 +0200

Download raw body.

Thread
On Tue, Aug 30, 2022 at 12:38:27PM -0600, Tracey Emery wrote:
> This gets rid of that very annoying (null) displayed on the index page.
> 
> ok?

> diff /home/tracey/src/got
> commit - 5e91dae4dd43b8024731223110ab18f505f453ac
> path + /home/tracey/src/got
> blob - 3c69584a92b6b958e709a94fbda0d8de2e82ccf9
> file + gotwebd/got_operations.c
> --- gotwebd/got_operations.c
> +++ gotwebd/got_operations.c
> @@ -131,6 +131,9 @@ got_get_repo_owner(char **owner, struct request *c, ch
>  		*owner = strdup(gitconfig_owner);
>  		if (*owner == NULL)
>  			return got_error_from_errno("strdup");
> +	} else {
> +		if (asprintf(owner, "%s", "") == -1)

Couldn't this use owner = strdup("")?

> +			return got_error_from_errno("asprintf");
>  	}
>  	return error;
>  }
> blob - f42caf75b1d7617a6d2c489ec63602ed33a0957d
> file + gotwebd/gotweb.c
> --- gotwebd/gotweb.c
> +++ gotwebd/gotweb.c
> @@ -2058,8 +2058,11 @@ gotweb_get_repo_description(char **description, struct
>  		goto done;
>  	}
>  
> -	if (len == 0)
> +	if (len == 0) {
> +		if (asprintf(description, "%s", "") == -1)
> +			return got_error_from_errno("asprintf");

Same here?

>  		goto done;
> +	}
>  
>  	if (fseek(f, 0, SEEK_SET) == -1) {
>  		error = got_ferror(f, GOT_ERR_IO);
> 
>