On 03/12/2016 18:32, Florian Fainelli wrote:
> libfstools/rootdisk.c: In function 'rootdisk_volume_identify':
> libfstools/rootdisk.c:172:7: error: ignoring return value of 'fread', 
> declared with attribute warn_unused_result [-Werror=unused-result]
>   fread(&magic, sizeof(magic), 1, f);
>        ^
> libfstools/rootdisk.c:179:7: error: ignoring return value of 'fread', 
> declared with attribute warn_unused_result [-Werror=unused-result]
>   fread(&magic, sizeof(magic), 1, f);
>        ^
> libfstools/rootdisk.c: In function 'rootdisk_volume_init':
> libfstools/rootdisk.c:268:9: error: ignoring return value of 'system', 
> declared with attribute warn_unused_result [-Werror=unused-result]
>    system(str);
>          ^
> cc1: all warnings being treated as errors
> 
> Signed-off-by: Florian Fainelli <f.faine...@gmail.com>
> ---
>  libfstools/rootdisk.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/libfstools/rootdisk.c b/libfstools/rootdisk.c
> index d4ff201bf926..b85bcedd98b7 100644
> --- a/libfstools/rootdisk.c
> +++ b/libfstools/rootdisk.c
> @@ -162,6 +162,7 @@ static int rootdisk_volume_identify(struct volume *v)
>       struct rootdev_volume *p = container_of(v, struct rootdev_volume, v);
>       int ret = FS_NONE;
>       uint32_t magic = 0;
> +     size_t n;
>       FILE *f;
>  
>       f = fopen(rootdev, "r");
> @@ -169,14 +170,18 @@ static int rootdisk_volume_identify(struct volume *v)
>               return ret;
>  
>       fseeko(f, p->offset + 0x400, SEEK_SET);
> -     fread(&magic, sizeof(magic), 1, f);
> +     n = fread(&magic, sizeof(magic), 1, f);
> +     if (n != sizeof(magic))
> +             return -1;
>  
>       if (magic == cpu_to_le32(0xF2F52010))
>               ret = FS_F2FS;
>  
>       magic = 0;
>       fseeko(f, p->offset + 0x438, SEEK_SET);
> -     fread(&magic, sizeof(magic), 1, f);
> +     n = fread(&magic, sizeof(magic), 1, f);
> +     if (n != sizeof(magic))
> +             return -1;

same issue as witht e uclient patch here i think

        John

>       if ((le32_to_cpu(magic) & 0xffff) == 0xef53)
>               ret = FS_EXT4;
>  
> @@ -251,6 +256,7 @@ static int rootdisk_volume_init(struct volume *v)
>  {
>       struct rootdev_volume *p = container_of(v, struct rootdev_volume, v);
>       char str[128];
> +     int ret = 0;
>  
>       if (!p->loop_name[0] && rootdisk_create_loop(p) != 0)
>               return -1;
> @@ -265,12 +271,12 @@ static int rootdisk_volume_init(struct volume *v)
>                       snprintf(str, sizeof(str), "mkfs.f2fs -l rootfs_data 
> %s", v->blk);
>               else
>                       snprintf(str, sizeof(str), "mkfs.ext4 -L rootfs_data 
> %s", v->blk);
> -             system(str);
> +             ret = system(str);
>               break;
>       default:
>               break;
>       }
> -     return 0;
> +     return ret;
>  }
>  
>  static struct driver rootdisk_driver = {
> 

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to