[PATCH 2 of 2] chg: change server's process title

Yuya Nishihara yuya at tcha.org
Wed Jan 11 10:03:35 EST 2017


On Wed, 11 Jan 2017 09:13:10 +0800, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1484091652 -28800
> #      Wed Jan 11 07:40:52 2017 +0800
> # Node ID b68bec41a5562c8fa0ed9ac0e94f0c2d6906a2e8
> # Parent  a82e9f172feff7ca2380b3db8833ddc64cd35429
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r b68bec41a556
> chg: change server's process title

> +static void updateprocname(hgclient_t *hgc)
> +{
> +	size_t n = (size_t)snprintf(hgc->ctx.data, hgc->ctx.maxdatasize,
> +			"chg[worker/%d]", (int)getpid());
> +	hgc->ctx.datasize = n;
> +	writeblockrequest(hgc, "setprocname");
> +}

snprintf() returns the length that would have been written to the buffer if
the buffer had enough space. I know maxdatasize should be at least 4k so
this is kinda nitpick, but I want to be strict about memory stuff.

Can you send a follow-up patch?


More information about the Mercurial-devel mailing list