From: Jeff King Date: Thu, 16 May 2019 21:52:01 GMT Subject: Re: [PATCH v2 6/7] config: allow configuration of multiple hook error behavior Message-ID: <20190516215201.GF10787@sigill.intra.peff.net> In-Reply-To: <20190516171953.GA265608@genre.crustytoothpaste.net> On Thu, May 16, 2019 at 05:19:53PM +0000, brian m. carlson wrote: > > > + /* Use -2 as sentinel because failure to exec is -1. */ > > > + int ret = -2; > > > > Maybe this would be simpler to follow by using an enum for the handler > > return value? > > We can't make this variable an enum because we'd have to define 256 > entries (well, we can, but it would be a hassle), but I can create an > enum and assign it to the int variable, sure. I think you can do: enum HOOK_ERR { HOOK_ERR_NONE = -2, HOOK_ERR_EXEC = -1, /* otherwise it should be a system exit code */ HOOK_ERR_MAX = 255 }; which ensures that the enum can hold any exit status. -Peff