Thread (34 messages) 34 messages, 6 authors, 2019-05-29

Re: [PATCH v2 6/7] config: allow configuration of multiple hook error behavior

From: Jeff King <hidden>
Date: 2019-05-16 21:52:04

On Thu, May 16, 2019 at 05:19:53PM +0000, brian m. carlson wrote:
quoted
quoted
+	/* 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help