diff options
author | Rouven Czerwinski <r.czerwinski@pengutronix.de> | 2021-03-12 11:54:44 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-16 11:31:22 +0100 |
commit | d090081414b84d82261a19aefb46c823427847f1 (patch) | |
tree | 8b88f839adf683b0b81609f0911d2ef8caa7fc83 /scripts | |
parent | 1d9a83051b64f7821aceacb5ce0a0474046ba5b2 (diff) | |
download | barebox-d090081414b84d82261a19aefb46c823427847f1.tar.gz barebox-d090081414b84d82261a19aefb46c823427847f1.tar.xz |
scripts: imx-image: add error handling for pwrite
Fixes the following compiler warning:
scripts/imx/imx-image.c: In function ‘main’:
scripts/imx/imx-image.c:988:3: warning: ignoring return value of ‘pwrite’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
988 | pwrite(outfd, bb_header, sizeof_bb_header, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/imx/imx-image.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c index f5e89d07a6..57d777a065 100644 --- a/scripts/imx/imx-image.c +++ b/scripts/imx/imx-image.c @@ -984,8 +984,13 @@ int main(int argc, char *argv[]) xwrite(outfd, buf, header_len); } - if (add_barebox_header) - pwrite(outfd, bb_header, sizeof_bb_header, 0); + if (add_barebox_header) { + ret = pwrite(outfd, bb_header, sizeof_bb_header, 0); + if (ret < 0) { + fprintf(stderr, "pwrite failed: %s\n", strerror(errno)); + exit(1); + } + } xwrite(outfd, infile, insize); |