Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 5155)
+++ roard/clients.c	(revision 5162)
@@ -570,6 +570,4 @@
     event = ROAR_NOTIFY_CMD2EVENT(m.cmd);
 
-    roar_debug_message_print(&m);
-
     oldcmd = m.cmd;
 
Index: roard/codecfilter_flac.c
===================================================================
--- roard/codecfilter_flac.c	(revision 5131)
+++ roard/codecfilter_flac.c	(revision 5162)
@@ -147,5 +147,8 @@
     continue;
 
-   stream_meta_add(ROAR_STREAM(self->ss)->id, type, "", value);
+   if ( stream_meta_add(ROAR_STREAM(self->ss)->id, type, "", value) == -1 ) {
+    ROAR_WARN("cf_flac_cb_metadata(..., client_data=%p{ROAR_STREAM(.ss)->id=%i}): Can not add meta data: %s",
+              ROAR_STREAM(self->ss)->id, roar_error2str(roar_error));
+   }
 
     if ( strcmp(keycopy, "REPLAYGAIN_TRACK_PEAK") == 0 ) {
@@ -252,5 +255,6 @@
   stats.bytes = 0;
  } else {
-  roar_buffer_ring_stats(self->decoder.written, &stats);
+  if ( roar_buffer_ring_stats(self->decoder.written, &stats) == -1 )
+   return -1;
  }
 
@@ -275,5 +279,6 @@
    stats.bytes = 0;
   } else {
-   roar_buffer_ring_stats(self->decoder.written, &stats);
+   if ( roar_buffer_ring_stats(self->decoder.written, &stats) == -1 )
+    return -1;
   }
  }
Index: roard/driver_dstr.c
===================================================================
--- roard/driver_dstr.c	(revision 4708)
+++ roard/driver_dstr.c	(revision 5162)
@@ -49,5 +49,5 @@
 
  if ( sstream != NULL )
-  roar_vio_ctl(inst, ROAR_VIO_CTL_SET_SSTREAM, sstream);
+  _LIBROAR_IGNORE_RET(roar_vio_ctl(inst, ROAR_VIO_CTL_SET_SSTREAM, sstream));
 
  return 0;
Index: roard/driver_esd.c
===================================================================
--- roard/driver_esd.c	(revision 4763)
+++ roard/driver_esd.c	(revision 5162)
@@ -54,9 +54,10 @@
  fh = esd_play_stream_fallback(format, info->rate, device, name);
 
- roar_vio_set_fh(inst, fh);
 
  // test for error.
  if ( fh == -1 )
   return -1;
+
+ roar_vio_open_fh_socket(inst, fh);
 
  roar_vio_shutdown(inst, ROAR_VIO_SHUTDOWN_READ);
Index: roard/driver_raw.c
===================================================================
--- roard/driver_raw.c	(revision 4708)
+++ roard/driver_raw.c	(revision 5162)
@@ -36,10 +36,10 @@
 
  if ( fh == -1 ) {
-  if ( (fh = open(device, O_CREAT|O_TRUNC|O_WRONLY, 0644)) == -1 ) {
+  if ( roar_vio_open_file(inst, device, O_CREAT|O_TRUNC|O_WRONLY, 0644) == -1 )
    return -1;
-  }
+ } else {
+  if ( roar_vio_open_fh(inst, fh) == -1 )
+   return -1;
  }
-
- roar_vio_set_fh(inst, fh);
 
  return 0;
Index: roard/driver_roar.c
===================================================================
--- roard/driver_roar.c	(revision 5056)
+++ roard/driver_roar.c	(revision 5162)
@@ -48,5 +48,7 @@
  if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard") == -1 ) {
   if ( streams_get_flag(ROAR_STREAM(sstream)->id, ROAR_FLAG_AUTOCONF) ) {
-   roar_profile2info(info, "default");
+   if ( roar_profile2info(info, "default") == -1 )
+    return -1;
+
    if ( roar_vio_simple_stream(inst, info->rate, info->channels, info->bits, info->codec, device, dir, "roard") == -1 ) {
     return -1;
Index: roard/hwmixer_dstr.c
===================================================================
--- roard/hwmixer_dstr.c	(revision 4752)
+++ roard/hwmixer_dstr.c	(revision 5162)
@@ -27,4 +27,11 @@
 
 #ifndef ROAR_WITHOUT_DCOMP_MIXER
+
+/*
+ * This driver ignores errors on seeks:
+ * The writes ensure that if the seek back to begin of file
+ * does not work the records keep seperate and parsable.
+ * So it basically enters some kind of streaming mode.
+ */
 
 //#define TEST_HWMIXER_SUBSTREAMS
@@ -63,5 +70,5 @@
 
  roar_vio_printf(vio, "No data yet.\n");
- roar_vio_lseek(vio, 0, SEEK_SET);
+ _LIBROAR_IGNORE_RET(roar_vio_lseek(vio, 0, SEEK_SET));
  roar_vio_sync(vio);
 
@@ -113,5 +120,5 @@
  }
 
- roar_vio_lseek(vio, 0, SEEK_SET);
+ _LIBROAR_IGNORE_RET(roar_vio_lseek(vio, 0, SEEK_SET));
  roar_vio_sync(vio);
  return 0;
Index: roard/include/meta.h
===================================================================
--- roard/include/meta.h	(revision 4708)
+++ roard/include/meta.h	(revision 5162)
@@ -30,7 +30,7 @@
 
 #ifdef ROAR_SUPPORT_META
-int stream_meta_set     (int id, int type, char * name, char * val);
-int stream_meta_add     (int id, int type, char * name, char * val);
-int stream_meta_get     (int id, int type, char * name, char * val, size_t len);
+int stream_meta_set     (int id, int type, const char * name, const char * val);
+int stream_meta_add     (int id, int type, const char * name, const char * val);
+int stream_meta_get     (int id, int type, const char * name, char * val, size_t len);
 int stream_meta_list    (int id, int * types, size_t len);
 int stream_meta_clear   (int id);
Index: roard/meta.c
===================================================================
--- roard/meta.c	(revision 5135)
+++ roard/meta.c	(revision 5162)
@@ -28,5 +28,5 @@
 #ifdef ROAR_SUPPORT_META
 
-int stream_meta_set   (int id, int type, char * name, char * val) {
+int stream_meta_set   (int id, int type, const char * name, const char * val) {
  int i;
  struct roar_stream_server * s = g_streams[id];
@@ -48,5 +48,5 @@
 }
 
-int stream_meta_add   (int id, int type, char * name, char * val) {
+int stream_meta_add   (int id, int type, const char * name, const char * val) {
  int i;
  char * c;
@@ -85,5 +85,5 @@
 }
 
-int stream_meta_get   (int id, int type, char * name, char * val, size_t len) {
+int stream_meta_get   (int id, int type, const char * name, char * val, size_t len) {
  int i, vallen;
  struct roar_stream_server * s = g_streams[id];
Index: roard/midi.c
===================================================================
--- roard/midi.c	(revision 5090)
+++ roard/midi.c	(revision 5162)
@@ -158,6 +158,6 @@
 
  if ( roar_buffer_new_data(&b, MIDI_READ_SIZE, &buf) == -1 ) {
-  ROAR_ERR("midi_check_stream(*): Can not alloc buffer space!");
-  ROAR_DBG("midi_check_stream(*) = -1");
+  ROAR_ERR("midi_check_stream(id=%i): Can not alloc buffer space!", id);
+  ROAR_DBG("midi_check_stream(id=%i) = -1", id);
   return -1;
  }
@@ -169,5 +169,10 @@
  }
 
- roar_buffer_set_len(b, len);
+ if ( roar_buffer_set_len(b, len) == -1 ) {
+  ROAR_WARN("midi_check_stream(id=%i): Can not set buffer size. BAD.", id);
+  roar_buffer_free(b);
+  streams_delete(id);
+  return -1;
+ }
 
  if ( stream_add_buffer(id, b) == -1 ) {
@@ -348,5 +353,8 @@
   }
 
-  roar_buffer_next(&(ss->buffer));
+  if ( roar_buffer_next(&(ss->buffer)) == -1 ) {
+   ROAR_WARN("midi_conv_midi2mes(id=%i): Can not move to next buffer segment. BAD.", id);
+   break;
+  }
  }
 
@@ -672,10 +680,13 @@
 
 int midi_add_buf       (int id, struct roar_buffer * buf) {
+#ifdef DEBUG
  struct midi_message * mes;
  void * bufdata;
+#endif
 
  if ( id == -1 || buf == NULL )
   return -1;
 
+#ifdef DEBUG
  if ( roar_buffer_get_data(buf, &bufdata) == -1 )
   return -1;
@@ -688,9 +699,13 @@
  ROAR_DBG("midi_add_buf(*): flags=0x%.2X", mes->flags);
  ROAR_DBG("midi_add_buf(*): kk=0x%.2X, vv=0x%.2X", mes->kk, mes->vv);
+#endif
 
  if ( g_midi_mess.buf == NULL ) {
   g_midi_mess.buf = buf;
  } else {
-  roar_buffer_add(g_midi_mess.buf, buf);
+  if ( roar_buffer_add(g_midi_mess.buf, buf) == -1 ) {
+   ROAR_DBG("midi_add_buf(*) = -1");
+   return -1;
+  }
  }
 
Index: roard/output.c
===================================================================
--- roard/output.c	(revision 5063)
+++ roard/output.c	(revision 5162)
@@ -454,6 +454,6 @@
  }
 
- roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAMID, &stream); // ignore errors here
- roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s); // ignore errors here
+ _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAMID, &stream)); // ignore errors here
+ _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s)); // ignore errors here
 
  if ( blocks != -1 )
Index: roard/sample.c
===================================================================
--- roard/sample.c	(revision 4975)
+++ roard/sample.c	(revision 5162)
@@ -100,4 +100,5 @@
  struct roar_buffer * new;
  struct roar_sample * c = g_samples[id];
+ int save_err;
 
  if ( c == NULL )
@@ -110,5 +111,10 @@
   c->data = new;
  } else {
-  roar_buffer_add(c->data, new);
+  if ( roar_buffer_add(c->data, new) == -1 ) {
+   save_err = roar_error;
+   roar_buffer_free(new);
+   roar_err_set(save_err);
+   return -1;
+  }
  }
 
Index: roard/sources.c
===================================================================
--- roard/sources.c	(revision 4964)
+++ roard/sources.c	(revision 5162)
@@ -233,6 +233,6 @@
  }
 
- roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAMID, &stream); // ignore errors here
- roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s); // ignore errors here
+ _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAMID, &stream)); // ignore errors here
+ _LIBROAR_IGNORE_RET(roar_vio_ctl(&(ss->vio), ROAR_VIO_CTL_SET_SSTREAM,   s)); // ignore errors here
 
  if ( f_sync ) {
@@ -251,11 +251,13 @@
  struct roar_stream_server * ss;
 
- if ( fh > -1 )
-  return streams_set_fh(stream, fh);
-
  streams_get(stream, &ss);
 
- if ( roar_vio_open_file(&(ss->vio), device, O_RDONLY, 0644) == -1 )
-  return -1;
+ if ( fh > -1 ) {
+  if ( roar_vio_open_fh(&(ss->vio), fh) == -1 )
+   return -1;
+ } else {
+  if ( roar_vio_open_file(&(ss->vio), device, O_RDONLY, 0644) == -1 )
+   return -1;
+ }
 
  return streams_set_fh(stream, -2);
