AROS: Add copyright boilerplate for aros_compat.c
[deb_libnfs.git] / aros / aros_compat.c
index 6e484f4cad79ab6935b8ec9986667e290a72ce88..92da9a370c35d83172a316508ae96c27fbc1ad71 100644 (file)
@@ -1,3 +1,19 @@
+/*
+   Copyright (C) 2013 by Ronnie Sahlberg <ronniesahlberg@gmail.com>
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
+*/
 
 #ifdef AROS
 
@@ -9,6 +25,8 @@
 #include <sys/socket.h>
 #include <netdb.h>
 #include "aros_compat.h"
+#include <errno.h>
+#include <bsdsocket/socketbasetags.h>
 
 #undef poll
 
@@ -77,12 +95,23 @@ int minor(int i)
 
 struct Library * SocketBase = NULL;
 
+extern int errno;
+int h_errno = 0;
+
+
 void aros_init_socket(void)
 {
   if (!(SocketBase = OpenLibrary("bsdsocket.library", 4))) {
     printf("NoTCP/IP Stack available");
     exit(10);
   }
+  if (SocketBaseTags(SBTM_SETVAL(SBTC_ERRNOPTR(sizeof(errno))),
+                     (IPTR)&errno,
+                     SBTM_SETVAL(SBTC_HERRNOLONGPTR),
+                     (IPTR)&h_errno, TAG_DONE)) {
+    printf("Failed to set ERRNO");
+    exit(10);
+  }
 }
 
 int aros_poll(struct pollfd *fds, unsigned int nfds, int timo)