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

Jun Wu quark at fb.com
Wed Jan 11 10:44:21 EST 2017


Excerpts from Yuya Nishihara's message of 2017-01-12 00:03:35 +0900:
> 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?

Sure. I grafted the change from an older commit. If I were writing it again,
I probably will check the return value.


More information about the Mercurial-devel mailing list