Browse Source

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>
Chris Ruffin 14 năm trước cách đây
mục cha
commit
b8cb464e4a
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      firmware/ihex2fw.c

+ 5 - 4
firmware/ihex2fw.c

@@ -124,8 +124,7 @@ int main(int argc, char **argv)
 	if (process_ihex(data, st.st_size))
 	if (process_ihex(data, st.st_size))
 		return 1;
 		return 1;
 
 
-	output_records(outfd);
-	return 0;
+	return output_records(outfd);
 }
 }
 
 
 static int process_ihex(uint8_t *data, ssize_t size)
 static int process_ihex(uint8_t *data, ssize_t size)
@@ -269,11 +268,13 @@ static int output_records(int outfd)
 
 
 		p->addr = htonl(p->addr);
 		p->addr = htonl(p->addr);
 		p->len = htons(p->len);
 		p->len = htons(p->len);
-		write(outfd, &p->addr, writelen);
+		if (write(outfd, &p->addr, writelen) != writelen)
+			return 1;
 		p = p->next;
 		p = p->next;
 	}
 	}
 	/* EOF record is zero length, since we don't bother to represent
 	/* EOF record is zero length, since we don't bother to represent
 	   the type field in the binary version */
 	   the type field in the binary version */
-	write(outfd, zeroes, 6);
+	if (write(outfd, zeroes, 6) != 6)
+		return 1;
 	return 0;
 	return 0;
 }
 }