[PATCH 5 of 5] chg: forward umask from client to server

Yuya Nishihara yuya at tcha.org
Tue Feb 16 11:36:37 EST 2016


On Tue, 16 Feb 2016 15:24:32 +0000, Jun Wu wrote:
> On 02/16/2016 02:26 PM, Yuya Nishihara wrote:
> >> +static void forwardumask(hgclient_t *hgc)
> >> +{
> >> +	mode_t mask = umask(0);
> >> +	int n = snprintf(hgc->ctx.data, hgc->ctx.maxdatasize, "%d", mask);
> >> +	if (n >= (int)hgc->ctx.maxdatasize || n <= 0)
> >> +		abortmsg("unexpected umask length (%d)", n);
> >> +	hgc->ctx.datasize = (size_t)n;
> >> +	writeblockrequest(hgc, "umask");
> >> +	umask(mask);
> >> +}
> >
> > Nit: I prefer doing umask(mask) immediately to narrow the scope.
> 
> I was thinking from another point of view: to make the server start
> working asap so send data earlier. Although umask is surely too fast
> to notice the difference.

Hmm, but that makes the time span of umask(0) much longer because of I/O wait,
and the client have to pay the cost of umask(mask) anyway.


More information about the Mercurial-devel mailing list