Index: include/libroar/vio_dstr.h
===================================================================
--- include/libroar/vio_dstr.h	(revision 5227)
+++ include/libroar/vio_dstr.h	(revision 5253)
@@ -140,10 +140,10 @@
 
  union {
-  char *   file;
-  int      fh;
+  const char *  file;
+  int           fh;
   struct {
           int               domain;
           int               type;
-          char            * host;
+          const char      * host;
           union {
                  struct sockaddr     sa;
Index: include/libroar/vio_socket.h
===================================================================
--- include/libroar/vio_socket.h	(revision 4708)
+++ include/libroar/vio_socket.h	(revision 5253)
@@ -51,17 +51,17 @@
 int     roar_vio_socket_get_port          (char * service, int domain, int type);
 
-int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, char * path);
+int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, const char * path);
 
 int     roar_vio_socket_init_decnetnode_def(struct roar_vio_defaults * def);
-int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, char * node, int object, char * objname);
+int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, const char * node, int object, char * objname);
 
 int     roar_vio_socket_init_inet4host_def(struct roar_vio_defaults * def);
-int     roar_vio_socket_init_inet4_def    (struct roar_vio_defaults * def, char * host, int port, int type);
-int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, char * host, int port);
-int     roar_vio_socket_init_udp4_def     (struct roar_vio_defaults * def, char * host, int port);
+int     roar_vio_socket_init_inet4_def    (struct roar_vio_defaults * def, const char * host, int port, int type);
+int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, const char * host, int port);
+int     roar_vio_socket_init_udp4_def     (struct roar_vio_defaults * def, const char * host, int port);
 int     roar_vio_socket_init_inet6host_def(struct roar_vio_defaults * def);
-int     roar_vio_socket_init_inet6_def    (struct roar_vio_defaults * def, char * host, int port, int type);
-int     roar_vio_socket_init_tcp6_def     (struct roar_vio_defaults * def, char * host, int port);
-int     roar_vio_socket_init_udp6_def     (struct roar_vio_defaults * def, char * host, int port);
+int     roar_vio_socket_init_inet6_def    (struct roar_vio_defaults * def, const char * host, int port, int type);
+int     roar_vio_socket_init_tcp6_def     (struct roar_vio_defaults * def, const char * host, int port);
+int     roar_vio_socket_init_udp6_def     (struct roar_vio_defaults * def, const char * host, int port);
 
 #endif
Index: libroar/vio.c
===================================================================
--- libroar/vio.c	(revision 5242)
+++ libroar/vio.c	(revision 5253)
@@ -306,37 +306,14 @@
 // converters:
 int     roar_vio_open_file     (struct roar_vio_calls * calls, const char * filename, int flags, mode_t mode) {
-#ifdef _CAN_OPERATE
- int fh;
+ struct roar_vio_defaults def;
 
  roar_debug_warn_obsolete("roar_vio_open_file", "roar_vio_open_dstr", NULL);
 
- if ( calls == NULL || filename == NULL ) {
-  roar_err_set(ROAR_ERROR_FAULT);
-  return -1;
- }
-
-#ifdef ROAR_TARGET_WIN32
- flags |= O_BINARY;
-#endif
-
- roar_err_clear_all();
- if ( (fh = open(filename, flags, mode)) == -1 ) {
-  ROAR_DBG("roar_vio_open_file(*): errno=%s", strerror(errno));
-  roar_err_update();
-  ROAR_DBG("roar_vio_open_file(*): errno=%s", strerror(errno));
-  return -1;
- }
-
- if ( roar_vio_open_fh(calls, fh) == -1 ) {
-  close(fh);
-  roar_err_update();
-  return -1;
- }
-
- roar_err_update();
- return 0;
-#else
- return -1;
-#endif
+ if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_FILE, flags, mode) == -1 )
+  return -1;
+
+ def.d.file = filename;
+
+ return roar_vio_open_default(calls, &def, NULL);
 }
 
Index: libroar/vio_dstr.c
===================================================================
--- libroar/vio_dstr.c	(revision 5227)
+++ libroar/vio_dstr.c	(revision 5253)
@@ -322,9 +322,41 @@
 
 #ifndef ROAR_WITHOUT_VIO_DSTR
+#ifdef ROAR_HAVE_IO_POSIX
+static int _open_file(struct roar_vio_calls * calls, const char * filename, int flags, mode_t mode) {
+ int fh;
+
+ if ( calls == NULL || filename == NULL ) {
+  roar_err_set(ROAR_ERROR_FAULT);
+  return -1;
+ }
+
+#ifdef ROAR_TARGET_WIN32
+ flags |= O_BINARY;
+#endif
+
+ roar_err_clear_all();
+ if ( (fh = open(filename, flags, mode)) == -1 ) {
+  roar_err_update();
+  return -1;
+ }
+
+ if ( roar_vio_open_fh(calls, fh) == -1 ) {
+  close(fh);
+  roar_err_to_errno();
+  return -1;
+ }
+
+ roar_err_update();
+ return 0;
+}
+#endif
+
 int     roar_vio_open_default (struct roar_vio_calls * calls, struct roar_vio_defaults * def, char * opts) {
  ROAR_DBG("roar_vio_open_default(calls=%p, def=%p, opts='%s') = ?", calls, def, opts);
 
- if ( calls == NULL || def == NULL )
-  return -1;
+ if ( calls == NULL || def == NULL ) {
+  roar_err_set(ROAR_ERROR_FAULT);
+  return -1;
+ }
 
  switch (def->type) {
@@ -332,11 +364,8 @@
    break;
   case ROAR_VIO_DEF_TYPE_FILE:
-    roar_libroar_nowarn();
-    if ( roar_vio_open_file(calls, def->d.file, def->o_flags, def->o_mode) == -1 ) {
-     roar_libroar_warn();
+    if ( _open_file(calls, def->d.file, def->o_flags, def->o_mode) == -1 ) {
      ROAR_DBG("roar_vio_open_default(*): Can not open file: %i", roar_error);
      return -1;
     }
-    roar_libroar_warn();
    break;
   case ROAR_VIO_DEF_TYPE_SOCKET:
Index: libroar/vio_socket.c
===================================================================
--- libroar/vio_socket.c	(revision 5248)
+++ libroar/vio_socket.c	(revision 5253)
@@ -493,5 +493,5 @@
 
 // AF_UNIX:
-int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, char * path) {
+int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, const char * path) {
 #if defined(ROAR_HAVE_UNIX) && defined(_CAN_OPERATE)
  if ( def == NULL || path == NULL )
@@ -519,5 +519,8 @@
   return -1;
 
- if ( (node = def->d.socket.host) == NULL )
+ if ( def->d.socket.host == NULL )
+  return -1;
+
+ if ( (node = roar_mm_strdup(def->d.socket.host)) == NULL )
   return -1;
 
@@ -525,7 +528,10 @@
   *ed = 0;
 
- if ( (ne = getnodebyname(node)) == NULL ) {
+ ne = getnodebyname(node);
+
+ roar_mm_free(ed);
+
+ if ( ne == NULL ) {
   ROAR_ERR("roar_vio_socket_init_decnetnode_def(*): Can\'t resolve node name '%s'", node);
-  if ( ed != NULL ) *ed = '/';
   return -1;
  }
@@ -533,14 +539,11 @@
  memcpy(&(def->d.socket.sa.dn.sdn_add.a_addr), ne->n_addr, 2);
 
- if ( ed != NULL ) *ed = '/';
-
-
- return 0;
-#else
- return -1;
-#endif
-}
-
-int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, char * node, int object, char * objname) {
+ return 0;
+#else
+ return -1;
+#endif
+}
+
+int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, const char * node, int object, char * objname) {
 #if defined(ROAR_HAVE_LIBDNET) && defined(_CAN_OPERATE)
  struct sockaddr_dn * dn;
@@ -626,5 +629,5 @@
 }
 
-int     roar_vio_socket_init_inet4_def    (struct roar_vio_defaults * def, char * host, int port, int type) {
+int     roar_vio_socket_init_inet4_def    (struct roar_vio_defaults * def, const char * host, int port, int type) {
 #if defined(ROAR_HAVE_IPV4) && defined(_CAN_OPERATE)
  if ( roar_vio_socket_init_socket_def(def, AF_INET, type) == -1 )
@@ -641,9 +644,9 @@
 }
 
-int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, char * host, int port) {
+int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, const char * host, int port) {
  return roar_vio_socket_init_inet4_def(def, host, port, SOCK_STREAM);
 }
 
-int     roar_vio_socket_init_udp4_def     (struct roar_vio_defaults * def, char * host, int port) {
+int     roar_vio_socket_init_udp4_def     (struct roar_vio_defaults * def, const char * host, int port) {
  return roar_vio_socket_init_inet4_def(def, host, port, SOCK_DGRAM);
 }
@@ -652,13 +655,13 @@
 // AF_INET6:
 int     roar_vio_socket_init_inet6host_def(struct roar_vio_defaults * def);
-int     roar_vio_socket_init_inet6_def    (struct roar_vio_defaults * def, char * host, int port, int type) {
- return -1;
-}
-
-int     roar_vio_socket_init_tcp6_def     (struct roar_vio_defaults * def, char * host, int port) {
+int     roar_vio_socket_init_inet6_def    (struct roar_vio_defaults * def, const char * host, int port, int type) {
+ return -1;
+}
+
+int     roar_vio_socket_init_tcp6_def     (struct roar_vio_defaults * def, const char * host, int port) {
  return roar_vio_socket_init_inet6_def(def, host, port, SOCK_STREAM);
 }
 
-int     roar_vio_socket_init_udp6_def     (struct roar_vio_defaults * def, char * host, int port) {
+int     roar_vio_socket_init_udp6_def     (struct roar_vio_defaults * def, const char * host, int port) {
  return roar_vio_socket_init_inet6_def(def, host, port, SOCK_DGRAM);
 }
