Re: [PATCH 3/3] crypto: digest: Return -errno if stat() fails

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

 



On Wed, Jan 16, 2019 at 08:45:06PM -0800, Andrey Smirnov wrote:
> Strictly speaking, stat() doesn't return a detailed error code as its
> return value and it can and should be obtained via 'errno'.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> ---
>  crypto/digest.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/crypto/digest.c b/crypto/digest.c
> index 230db26e8..2c4de2e4f 100644
> --- a/crypto/digest.c
> +++ b/crypto/digest.c
> @@ -317,12 +317,9 @@ int digest_file(struct digest *d, const char *filename,
>  		const unsigned char *sig)
>  {
>  	struct stat st;
> -	int ret;
> -
> -	ret = stat(filename, &st);
>  
> -	if (ret < 0)
> -		return ret;
> +	if (stat(filename, &st))
> +		return -errno;
>  
>  	return digest_file_window(d, filename, hash, sig, 0, st.st_size);
>  }
Likewise fine,
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux