Subject: Re: [PATCH v3 1/3] daemon: replace atoi() with strtoul_ui() and strtol_i()

From: Taylor Blau <[email-masked]>
Date: Tue, 22 Oct 2024 12:21:52 -0400

On Tue, Oct 22, 2024 at 05:23:41AM +0000, Usman Akinyemi via GitGitGadget wrote:
> diff --git a/daemon.c b/daemon.c
> index cb946e3c95f..09a31d2344d 100644
> --- a/daemon.c
> +++ b/daemon.c
> @@ -1308,17 +1308,20 @@ int cmd_main(int argc, const char **argv)
>  			continue;
>  		}
>  		if (skip_prefix(arg, "--timeout=", &v)) {
> -			timeout = atoi(v);
> +			if (strtoul_ui(v, 10, &timeout))
> +				die("invalid timeout '%s', expecting a non-negative integer", v);

The conversion you made to both (a) use warning() and (b) mark the
string for translation in the second patch were good, but I would have
expected to see them here as well.

Perhaps leaving this one as a die() makes sense, because we are taking
direct input from the user, so invoking 'git daemon' with bogus options
should result in us dying. But these strings should be marked as
translate-able regardless.

Thanks,
Taylor