Skip to content

Commit b8cb464

Browse files
Chris Ruffintorvalds
authored andcommitted
ihex: fix unused return value compiler warning
Fix unusued return value compiler warnings due to unchecked write() calls. [akpm@linux-foundation.org: correctly handle short writes] Signed-off-by: Chris Ruffin <cmruffin@gmail.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8369744 commit b8cb464

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎firmware/ihex2fw.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ int main(int argc, char **argv)
124124
if (process_ihex(data, st.st_size))
125125
return 1;
126126

127-
output_records(outfd);
128-
return 0;
127+
return output_records(outfd);
129128
}
130129

131130
static int process_ihex(uint8_t *data, ssize_t size)
@@ -269,11 +268,13 @@ static int output_records(int outfd)
269268

270269
p->addr = htonl(p->addr);
271270
p->len = htons(p->len);
272-
write(outfd, &p->addr, writelen);
271+
if (write(outfd, &p->addr, writelen) != writelen)
272+
return 1;
273273
p = p->next;
274274
}
275275
/* EOF record is zero length, since we don't bother to represent
276276
the type field in the binary version */
277-
write(outfd, zeroes, 6);
277+
if (write(outfd, zeroes, 6) != 6)
278+
return 1;
278279
return 0;
279280
}

0 commit comments

Comments
 (0)