[U-Boot] [PATCH 1/4] tools: imx8image: check lseek return value

Fabio Estevam festevam at gmail.com
Thu Nov 1 10:17:42 UTC 2018


Hi Peng,

On Thu, Nov 1, 2018 at 3:42 AM Peng Fan <peng.fan at nxp.com> wrote:

>         size = sbuf.st_size;
> -       lseek(ifd, offset, SEEK_SET);
> +       if (lseek(ifd, offset, SEEK_SET) == -1) {
> +               fprintf(stderr, "%s: lseek error %s\n",
> +                       __func__, strerror(errno));
> +               exit(EXIT_FAILURE);
> +       }

What about something like this instead?

ret = lseek(ifd, offset, SEEK_SET);
if (ret < 0) {
               fprintf(stderr, "%s: lseek error: %d\n", __func__, ret);
               exit(EXIT_FAILURE);
}


More information about the U-Boot mailing list