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

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

 



2013/11/4 Stanislaw Wadas:

> @@ -127,6 +132,7 @@ static void gadget_write_buf(char *path, char *name, char *file, char *buf)
>  {
>         char p[MAX_LENGHT];
>         FILE *fp;
> +       int ret;

this new variable isn't used in the hunk that follows:

>         sprintf(p, "%s/%s/%s", path, name, file);
>
> @@ -136,7 +142,11 @@ static void gadget_write_buf(char *path, char *name, char *file, char *buf)
>                 return;
>         }
>
> -       fputs(buf, fp);
> +       if (fputs(buf, fp) == EOF) {
> +       ERROR("write error");
> +       fclose(fp);
> +       return;
> +       }
>
>         fclose(fp);
>  }
> --

-- 
Daniele Forsi
--
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