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

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

 



On Wed, Jan 16, 2019 at 08:45:04PM -0800, Andrey Smirnov wrote:
> Strictly speaking, open() 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/digest.c b/crypto/digest.c
> index 9b7b73019..493e56902 100644
> --- a/crypto/digest.c
> +++ b/crypto/digest.c
> @@ -289,7 +289,7 @@ int digest_file_window(struct digest *d, const char *filename,
>  	fd = open(filename, O_RDONLY);
>  	if (fd < 0) {
>  		perror(filename);
> -		return fd;
> +		return -errno;
>  	}
>  
>  	buf = memmap(fd, PROT_READ);

Looks 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