commit f9c7f434c15db28d2e020de8292d21b83caf1c76
parent dece4a841bcbda6b10b5ec0ab944a88c79b89e9e
Author: sin <sin@2f30.org>
Date: Thu, 24 Mar 2016 10:27:34 +0000
fix error handling for linux too
Diffstat:
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/stun.c b/stun.c
@@ -211,13 +211,23 @@ opendev(char *dev)
int
writedev(int fd, unsigned char *buf, int len)
{
- return write(fd, buf, len);
+ int n;
+
+ n = write(fd, buf, len);
+ if (n < 0)
+ logerr("write failed");
+ return n;
}
int
readdev(int fd, unsigned char *buf, int len)
{
- return read(fd, buf, len);
+ int n;
+
+ n = read(fd, buf, len);
+ if (n < 0)
+ logerr("read failed");
+ return n;
}
#elif defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
int