aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-01-20 18:53:03 +0100
committerAleksander Morgado <aleksander@aleksander.es>2017-01-20 18:53:03 +0100
commit462321e11dd91ef82a005e81e916438d4c0e06d8 (patch)
treee9f12b2e61136faeebc0b7e41d147c6d3d591737
parent58c2b808ffe1b451035f3247e4f8ec5735391b69 (diff)
downloadexternal_libqmi-462321e11dd91ef82a005e81e916438d4c0e06d8.zip
external_libqmi-462321e11dd91ef82a005e81e916438d4c0e06d8.tar.gz
external_libqmi-462321e11dd91ef82a005e81e916438d4c0e06d8.tar.bz2
utils,swi-update: don't ignore write() return
swi-update.c: In function ‘download_image’: swi-update.c:846:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] write(serfd, buf, rlen); ^ swi-update.c: In function ‘write_hdlc’: swi-update.c:704:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result] write(fd, wbuf, wlen); ^ cc1: all warnings being treated as errors
-rw-r--r--utils/swi-update.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/swi-update.c b/utils/swi-update.c
index 5183524..fb1683e 100644
--- a/utils/swi-update.c
+++ b/utils/swi-update.c
@@ -701,8 +701,10 @@ static int write_hdlc(int fd, const char *in, size_t inlen)
wlen = hdlc_frame(in, inlen, wbuf, sizeof(wbuf));
if (wlen > 0) {
- write(fd, wbuf, wlen);
- print_packet("write", wbuf, wlen);
+ if (write(fd, wbuf, wlen) < 0)
+ fprintf(stderr, "error writing HDLC");
+ else
+ print_packet("write", wbuf, wlen);
} else {
debug("hdlc_frame() returned %d\n", wlen);
}
@@ -843,7 +845,10 @@ static int download_image(int serfd, char *buf, const char *image)
FD_SET(serfd, &wr);
if (select(serfd + 1, NULL, &wr, NULL, &tv) <= 0)
goto out;
- write(serfd, buf, rlen);
+ if (write(serfd, buf, rlen) < 0) {
+ fprintf(stderr, "error writing data");
+ goto out;
+ }
ret = read_and_parse(serfd, false);
if (ret < 0)
goto out;