Re: [PATCH 2/2] ima-evm-utils: Never exit with -1 code

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

 



On Sat, 2019-07-27 at 06:19 +0300, Vitaly Chikunov wrote:
> Change main() return code from -1 to 125 as -1 is not really valid exit
> code. 125 is choosen because exit codes for signals start from 126.
> 
> Signed-off-by: Vitaly Chikunov <vt@xxxxxxxxxxxx>
> ---
>  src/evmctl.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/evmctl.c b/src/evmctl.c
> index d33a91e..e0a835f 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -2100,6 +2100,8 @@ int main(int argc, char *argv[])
>  				break;
>  			log_err("%s\n", ERR_error_string(error, NULL));
>  		}
> +		if (err < 0)
> +			err = 125;
>  	}
>  
>  	if (eng) {

Agreed we need to return better errors, but instead of always
returning 125, would it be better to return the first errno, if err is
-1?

Mimi



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux