Re: [PATCH 2/2] hooks: fix a TOCTOU in "did we run a hook?" heuristic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...);
> +int run_commit_hook(int editor_is_used, const char *index_file,
> +		    int *invoked_hook, const char *name, ...);
>  

Even though my gut feeling tells me that turning the "yes/no"
integer into an enum that includes "there was no such hook", "I
tried to run it, but it failed to run" [*], "I ran it and it was
happy".  would be a more viable approach for the longer term, I
guess this extra and ad-hoc parameter would be sufficient as a
shorter term improvement.

    Side note: optionally "failed to run" may be split into "failed
    to even start (e.g. ENOEXEC)" and "started successfully but
    exited with non-zero status".  There may or may not be callers
    that wants to see them as distinct cases right now, but an
    interface based on returned enum value would be easier to extend
    than having to add a pointer to return variable every time we
    need to know more details.

Thanks.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux