Re: [PATCH 2/2] added fputs() fgets() error handling

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

 



On Mon, Nov 04, 2013 at 02:55:48PM +0100, Stanislaw Wadas wrote:
> Change-Id: I787380dda981c7cee6508a4ff566d7ca9fb273cf
> Signed-off-by: Stanislaw Wadas <s.wadas@xxxxxxxxxxx>
> ---
>  src/gadget.c |   12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gadget.c b/src/gadget.c
> index faed675..ff4f3d5 100644
> --- a/src/gadget.c
> +++ b/src/gadget.c
> @@ -93,6 +93,11 @@ static char *gadget_read_buf(char *path, char *name, char *file, char *buf)
>  		goto out;
>  
>  	ret = fgets(buf, MAX_LENGHT, fp);
> +	if (ret == NULL) {
> +	ERROR("read error");
> +	fclose(fp);
> +	return ret;
> +	}

What happened to your indentation?  :(

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux