summaryrefslogtreecommitdiff
path: root/tools/ncb.c
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 /tools/ncb.c
parentdbe29e36a4c2775b69b5a63b0ce2bac89c08e691 (diff)
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>
Diffstat (limited to 'tools/ncb.c')
-rw-r--r--tools/ncb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/ncb.c b/tools/ncb.c
index 30acbead5f3..ec8d8a74352 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;