Re: [PATCH BlueZ] mesh: Fix ignored return value

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

 



Applied with style-guide corrections:
Blank line ahead of "if"

On Tue, 2019-11-12 at 15:54 +0100, Michał Lowas-Rzechonek wrote:
> This fixes the following build error when compiling in maintainer mode:
> 
> mesh/keyring.c: In function ‘finalize’:
> mesh/keyring.c:142:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-
> Werror=unused-result]
>   (void)write(fd, &key, sizeof(key));
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  mesh/keyring.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/mesh/keyring.c b/mesh/keyring.c
> index 9fa7d6bd0..fe292b4a7 100644
> --- a/mesh/keyring.c
> +++ b/mesh/keyring.c
> @@ -140,7 +140,8 @@ static void finalize(const char *fpath, uint16_t net_idx)
>  	l_debug("Finalize %s", fpath);
>  	memcpy(key.old_key, key.new_key, 16);
>  	lseek(fd, 0, SEEK_SET);
> -	write(fd, &key, sizeof(key));
> +	if (write(fd, &key, sizeof(key)) != sizeof(key))
> +		goto done;
>  
>  done:
>  	close(fd);




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux