am 49454814: Make the raw socket and the tun fd nonblocking.

* commit '49454814a0a714189916cb2aea1922bc8784b13b':
  Make the raw socket and the tun fd nonblocking.
diff --git a/clatd.c b/clatd.c
index 94cb3b5..faeb679 100644
--- a/clatd.c
+++ b/clatd.c
@@ -198,7 +198,7 @@
  * mark - the socket mark to use for the sending raw socket
  */
 void open_sockets(struct tun_data *tunnel, uint32_t mark) {
-  int rawsock = socket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
+  int rawsock = socket(AF_INET6, SOCK_RAW | SOCK_NONBLOCK, IPPROTO_RAW);
   if (rawsock < 0) {
     logmsg(ANDROID_LOG_FATAL, "raw socket failed: %s", strerror(errno));
     exit(1);
@@ -314,6 +314,12 @@
     exit(1);
   }
 
+  error = set_nonblocking(tunnel->fd4);
+  if (error < 0) {
+    logmsg(ANDROID_LOG_FATAL, "set_nonblocking failed: %s", strerror(errno));
+    exit(1);
+  }
+
   configure_tun_ip(tunnel);
 }
 
@@ -330,7 +336,9 @@
   readlen = read(read_fd, buf, PACKETLEN);
 
   if(readlen < 0) {
-    logmsg(ANDROID_LOG_WARN,"read_packet/read error: %s", strerror(errno));
+    if (errno != EAGAIN) {
+      logmsg(ANDROID_LOG_WARN,"read_packet/read error: %s", strerror(errno));
+    }
     return;
   } else if(readlen == 0) {
     logmsg(ANDROID_LOG_WARN,"read_packet/tun interface removed");