summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Tyser <ptyser@xes-inc.com>2009-04-24 15:59:46 -0500
committerWolfgang Denk <wd@denx.de>2009-04-28 01:16:46 +0200
commiteea8be86d1c2b570660d1f6c553845e13164231a (patch)
tree635b2c23a2873e6bd9b7d3c2cd773b06f7a1a899
parentdbe29e36a4c2775b69b5a63b0ce2bac89c08e691 (diff)
downloadu-boot-imx-eea8be86d1c2b570660d1f6c553845e13164231a.zip
u-boot-imx-eea8be86d1c2b570660d1f6c553845e13164231a.tar.gz
u-boot-imx-eea8be86d1c2b570660d1f6c553845e13164231a.tar.bz2
ncb: Check return value of write()
This prevents the compilation warning: ncb.c: In function 'main': ncb.c:32: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
-rw-r--r--tools/ncb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/ncb.c b/tools/ncb.c
index 30acbea..ec8d8a7 100644
--- a/tools/ncb.c
+++ b/tools/ncb.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
@@ -29,7 +30,8 @@ int main (int argc, char *argv[])
len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len);
if (len < 0)
break;
- write (1, buf, len);
+ if (write (1, buf, len) != len)
+ fprintf(stderr, "WARNING: serial characters dropped\n");
}
return 0;