Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5893)
+++ ChangeLog	(revision 5895)
@@ -1,4 +1,5 @@
 v. 1.0beta10 - ?
 	* Added build summery feature to RABS and configure script.
+	* Moved away from roar_libroar_get_path_static().
 
 v. 1.0beta9 - Mon Feb 18 2013 23:28 CET
Index: libroar.ckport
===================================================================
--- libroar.ckport	(revision 5865)
+++ libroar.ckport	(revision 5895)
@@ -520,5 +520,5 @@
 roar_libroar_get_server		ok
 roar_libroar_get_path		ok
-roar_libroar_get_path_static	maybe	Should be avoided in flavor of roar_libroar_get_path()
+roar_libroar_get_path_static	legacy	Migrate to roar_libroar_get_path()
 roar_libroar_list_path		ok
 roar_libroar_set_memmgrapi	ok
Index: libroar/basic.c
===================================================================
--- libroar/basic.c	(revision 5848)
+++ libroar/basic.c	(revision 5895)
@@ -43,5 +43,7 @@
 static int _connect_server(struct roar_connection * con, const char * server, int type, int flags, uint_least32_t timeout);
 
-int __get_daemonimage(const char ** daemonimage, enum mode * mode, const char * server) {
+int __get_daemonimage(char ** daemonimage, enum mode * mode, const char * server) {
+ const char * tmp = NULL;
+
  *daemonimage = NULL;
  *mode = NORMAL;
@@ -61,9 +63,9 @@
   } else if ( server[0] == 'd' && server[1] == ':' ) {
    server += 2;
-   *daemonimage = server;
+   tmp = server;
    *mode = NORMAL;
   } else if ( server[0] == '!' ) {
    server += 1;
-   *daemonimage = server;
+   tmp = server;
    *mode = SYSTEM;
   } else {
@@ -73,17 +75,23 @@
  }
 
+ if ( tmp == NULL || *tmp == 0 )
+  tmp = roar_libroar_get_config()->daemonimage;
+
+ // we keep this step to be compatible with older versions.
+ if ( tmp == NULL || *tmp == 0 ) {
+  tmp = roar_env_get("ROAR_DAEMONIMAGE");
+  if ( tmp != NULL ) {
+   ROAR_WARN("__get_daemonimage(*): Usage of $ROAR_DAEMONIMAGE is obsolete. Use ROAR_OPTIONS=daemonimage:...");
+  }
+ }
+
+ if ( tmp != NULL && *tmp != 0 ) {
+  *daemonimage = roar_mm_strdup(tmp);
+  return 0;
+ }
+
+ *daemonimage = roar_libroar_get_path("bin-default-daemonimage", 0, NULL, NULL);
  if ( *daemonimage == NULL )
-  *daemonimage = roar_libroar_get_config()->daemonimage;
-
- // we keep this step to be compatible with older versions.
- if ( *daemonimage == NULL || **daemonimage == 0 ) {
-  *daemonimage = roar_env_get("ROAR_DAEMONIMAGE");
-  if ( *daemonimage != NULL ) {
-   ROAR_WARN("__get_daemonimage(*): Usage of $ROAR_DAEMONIMAGE is obsolete. Use ROAR_OPTIONS=daemonimage:...");
-  }
- }
-
- if ( *daemonimage == NULL || **daemonimage == 0 )
-  *daemonimage = roar_libroar_get_path_static("bin-default-daemonimage");
+  return -1;
 
  return 0;
@@ -94,5 +102,5 @@
 static int _start_server_win32(struct roar_connection * con, const char * server, int type, int flags, uint_least32_t timeout) {
  enum mode mode = NORMAL;
- const char * daemonimage = NULL;
+ char * daemonimage = NULL;
  char buf[64];
  int port;
@@ -105,4 +113,5 @@
 
  if ( mode != NORMAL ) {
+  roar_mm_free(daemonimage);
   roar_err_set(ROAR_ERROR_NOSYS);
   return -1;
@@ -122,4 +131,5 @@
 
  if ( i == NUM_TRIES ) {
+  roar_mm_free(daemonimage);
   roar_err_set(ROAR_ERROR_LOOP);
   return -1;
@@ -141,6 +151,11 @@
   roar_err_update();
   ROAR_ERR("_start_server_win32(server='%s', ...): Can not start server: %s: %s", server, daemonimage, roar_errorstring);
-  return -1;
- }
+  err = roar_error;
+  roar_mm_free(daemonimage);
+  roar_error = err;
+  return -1;
+ }
+
+ roar_mm_free(daemonimage);
 
  snprintf(buf, sizeof(buf), "localhost:%i", port);
@@ -166,9 +181,11 @@
 static int _start_server_posix(struct roar_connection * con, const char * server, int type, int flags, uint_least32_t timeout) {
  enum mode mode = NORMAL;
- const char * daemonimage = NULL;
+ char * daemonimage = NULL;
  int socks[2];
  int r;
  char fhstr[12];
  size_t len;
+ char * bin_sh;
+ int err;
 
  if ( __get_daemonimage(&daemonimage, &mode, server) == -1 )
@@ -183,4 +200,7 @@
  if ( socketpair(AF_UNIX, SOCK_STREAM, 0, socks) == -1 ) {
   roar_err_from_errno();
+  err = roar_error;
+  roar_mm_free(daemonimage);
+  roar_error = err;
   return -1;
  }
@@ -190,6 +210,9 @@
  if ( r == -1 ) { // error!
   ROAR_ERR("_start_server(*): Can not fork: %s", roar_error2str(roar_error));
+  err = roar_error;
   close(socks[0]);
   close(socks[1]);
+  roar_mm_free(daemonimage);
+  roar_error = err;
   return -1;
  } else if ( r == 0 ) { // we are the child
@@ -211,8 +234,14 @@
      dup2(socks[1], ROAR_STDIN );
      dup2(socks[1], ROAR_STDOUT);
-     execl(roar_libroar_get_path_static("bin-sh"), roar_libroar_get_path_static("bin-sh"), "-c", daemonimage, (_LIBROAR_GOOD_CAST char*)NULL);
+     bin_sh = roar_libroar_get_path("bin-sh", 0, NULL, NULL);
+     if ( bin_sh != NULL ) {
+      execl(bin_sh, bin_sh, "-c", daemonimage, (_LIBROAR_GOOD_CAST char*)NULL);
+      roar_mm_free(bin_sh);
+     }
      execlp("sh", "sh", "-c", daemonimage, (_LIBROAR_GOOD_CAST char*)NULL);
     break;
   }
+
+  roar_mm_free(daemonimage);
 
   // we are still alive?
@@ -221,4 +250,5 @@
  } else { // we are the parent
   close(socks[1]);
+  roar_mm_free(daemonimage);
   if ( roar_vio_open_fh_socket(con->viocon, socks[0]) == -1 ) {
    close(socks[0]);
@@ -398,4 +428,5 @@
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
  struct passwd * pwd;
+ char * sysconf_roarserver;
 #endif
 #ifdef ROAR_HAVE_LIBDNET
@@ -437,7 +468,11 @@
 
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
- if ( (server == NULL || *server == 0) && (i = readlink(roar_libroar_get_path_static("sysconf-roarserver"), user_sock, sizeof(user_sock)-1)) != -1 ) {
-   user_sock[i] = 0;
-   server = user_sock;
+ sysconf_roarserver = roar_libroar_get_path("sysconf-roarserver", 0, NULL, NULL);
+ if ( sysconf_roarserver != NULL ) {
+  if ( (server == NULL || *server == 0) && (i = readlink(sysconf_roarserver, user_sock, sizeof(user_sock)-1)) != -1 ) {
+    user_sock[i] = 0;
+    server = user_sock;
+  }
+  roar_mm_free(sysconf_roarserver);
  }
 #endif
@@ -467,19 +502,17 @@
   if ( roar_server == NULL ) {
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
-   if ( (pwd = getpwuid(getuid())) == NULL ) {
-    roar_server = roar_libroar_get_path_static("dir-nx-home");
-   } else {
+   if ( (pwd = getpwuid(getuid())) != NULL ) {
     roar_server = pwd->pw_dir;
    }
-#else
-   roar_server = "/WIN32-SUCKS";
-#endif
-  }
-
-  snprintf(user_sock, sizeof(user_sock)-1, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER);
-  user_sock[sizeof(user_sock)-1] = 0;
-
-  if ( _connect_server(con, user_sock, ROAR_SOCKET_TYPE_UNIX, flags, timeout) == 0 )
-   return 0;
+#endif
+  }
+
+  if ( roar_server != NULL ) {
+   snprintf(user_sock, sizeof(user_sock)-1, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER);
+   user_sock[sizeof(user_sock)-1] = 0;
+
+   if ( _connect_server(con, user_sock, ROAR_SOCKET_TYPE_UNIX, flags, timeout) == 0 )
+    return 0;
+  }
 
   if ( _connect_server(con, ROAR_DEFAULT_SOCK_GLOBAL, ROAR_SOCKET_TYPE_UNIX, flags, timeout) == 0 )
Index: libroar/cdrom.c
===================================================================
--- libroar/cdrom.c	(revision 5832)
+++ libroar/cdrom.c	(revision 5895)
@@ -53,4 +53,6 @@
  pid_t pid;
  int fh[2];
+ char * bin_cdparanoia = NULL, * dev_stdin = NULL;
+ int err;
 
  ROAR_DBG("roar_cdrom_run_cdparanoia(cdrom=%i, data=%i, track=%i, pos='%s') = ?", cdrom, data, track, pos);
@@ -91,6 +93,19 @@
  close(fh[1]);
 
- execl(roar_libroar_get_path_static("bin-cdparanoia"), roar_libroar_get_path_static("bin-cdparanoia"), "--force-cdrom-device", roar_libroar_get_path_static("dev-stdin"), "-q",
+ bin_cdparanoia = roar_libroar_get_path("bin-cdparanoia", 0, NULL, NULL);
+ if ( bin_cdparanoia == NULL )
+  return -1;
+ dev_stdin = roar_libroar_get_path("dev-stdin", 0, NULL, NULL);
+ if ( dev_stdin == NULL ) {
+  err = roar_error;
+  roar_mm_free(bin_cdparanoia);
+  roar_error = err;
+  return -1;
+ }
+ execl(bin_cdparanoia, bin_cdparanoia, "--force-cdrom-device", dev_stdin, "-q",
                 ROAR_CDROM_CDPARANOIA_OUTPUTFORMAT, pos, "-", NULL);
+
+ roar_mm_free(bin_cdparanoia);
+ roar_mm_free(dev_stdin);
 
  ROAR_CDROM_ERROR_NORETURN("We are still alive after exec()!, very bad!, error was: %s", strerror(errno));
Index: libroar/config.c
===================================================================
--- libroar/config.c	(revision 5884)
+++ libroar/config.c	(revision 5895)
@@ -572,5 +572,8 @@
 
  // special dirs:
- {"dir-nx-home",                "/NX-HOME-DIR", 0, 0}
+ {"dir-nx-home",                "/NX-HOME-DIR", 0, 0},
+#ifdef ROAR_TARGET_WIN32
+ {"dir-win32-sucks",            "/WIN32-SUCKS", 0, 0}
+#endif
 };
 
Index: libroar/enumdev.c
===================================================================
--- libroar/enumdev.c	(revision 5832)
+++ libroar/enumdev.c	(revision 5895)
@@ -145,7 +145,11 @@
 
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
-  if ( (i = readlink(roar_libroar_get_path_static("sysconf-roarserver"), buf, sizeof(buf)-1)) != -1 ) {
-    buf[i] = 0;
-    _add(buf);
+  tmp = roar_libroar_get_path("sysconf-roarserver", 0, NULL, NULL);
+  if ( tmp != NULL ) {
+   if ( (i = readlink(tmp, buf, sizeof(buf)-1)) != -1 ) {
+     buf[i] = 0;
+     _add(buf);
+   }
+   roar_mm_free(tmp);
   }
 #endif
Index: libroar/pinentry.c
===================================================================
--- libroar/pinentry.c	(revision 5832)
+++ libroar/pinentry.c	(revision 5895)
@@ -48,4 +48,5 @@
 #ifdef _CAN_OPERATE
  int in[2], out[2];
+ char * bin_pinentry;
 
  if ( pe == NULL )
@@ -112,5 +113,11 @@
      ROAR_U_EXIT(1);
 
-    execlp(roar_libroar_get_path_static("bin-pinentry"), "RoarAudio", "--display", display, "--ttytype", term, "--ttyname", tty, NULL);
+    bin_pinentry = roar_libroar_get_path("bin-pinentry", 0, NULL, NULL);
+    if ( bin_pinentry == NULL )
+     ROAR_U_EXIT(1);
+
+    execlp(bin_pinentry, "RoarAudio", "--display", display, "--ttytype", term, "--ttyname", tty, NULL);
+
+    roar_mm_free(bin_pinentry);
 
     ROAR_U_EXIT(1);
Index: libroar/socket.c
===================================================================
--- libroar/socket.c	(revision 5832)
+++ libroar/socket.c	(revision 5895)
@@ -1107,4 +1107,5 @@
  const char * proxy_addr = roar_env_get("ssh_proxy");
  char * sep;
+ char * bin_ssh;
  char   cmd[1024] = {0}, rcmd[1024] = {0};
  int    proxy_port = 22;
@@ -1164,6 +1165,12 @@
  ROAR_DBG("roar_socket_open_ssh(*): proxy_port=%i, user='%s', proxy_addr='%s'", proxy_port, user, proxy_addr);
  ROAR_DBG("roar_socket_open_ssh(*): rcmd: %s", rcmd);
- snprintf(cmd, 1023, "%s -p %i -l '%s' '%s' '%s'", roar_libroar_get_path_static("bin-ssh"), proxy_port, user, proxy_addr, rcmd);
+ bin_ssh = roar_libroar_get_path("bin-ssh", 0, NULL, NULL);
+ if ( bin_ssh == NULL )
+  return -1;
+
+ snprintf(cmd, 1023, "%s -p %i -l '%s' '%s' '%s'", bin_ssh, proxy_port, user, proxy_addr, rcmd);
  cmd[1023] = 0;
+
+ roar_mm_free(bin_ssh);
 
 
Index: libroar/vio_cmd.c
===================================================================
--- libroar/vio_cmd.c	(revision 5832)
+++ libroar/vio_cmd.c	(revision 5895)
@@ -141,4 +141,5 @@
 int roar_vio_cmd_fork(struct roar_vio_cmd_child * child) {
  int in[2], out[2];
+ char * bin_sh;
 
  if ( child == NULL )
@@ -185,5 +186,11 @@
      ROAR_U_EXIT(1);
 
-    execlp(roar_libroar_get_path_static("bin-sh"), roar_libroar_get_path_static("bin-sh"), "-c", child->cmd, (_LIBROAR_GOOD_CAST char*)NULL);
+    bin_sh = roar_libroar_get_path("bin-sh", 0, NULL, NULL);
+    if ( bin_sh == NULL )
+     ROAR_U_EXIT(1);
+
+    execlp(bin_sh, bin_sh, "-c", child->cmd, (_LIBROAR_GOOD_CAST char*)NULL);
+
+    roar_mm_free(bin_sh);
 
     ROAR_U_EXIT(1);
@@ -621,6 +628,8 @@
  char command[1024];
  char para[1024] = {0};
+ char * bin_gpg;
  int pwpipe[2];
  int ret;
+ int err;
 
 /*
@@ -640,9 +649,17 @@
   strncat(para, "--textmode ", 16);
 
+ bin_gpg = roar_libroar_get_path("bin-gpg", 0, NULL, NULL);
+ if ( bin_gpg == NULL )
+  return -1;
+
  if ( pw != NULL ) {
-  if ( pipe(pwpipe) == -1 )
+  if ( pipe(pwpipe) == -1 ) {
+   err = roar_error;
+   roar_mm_free(bin_gpg);
+   roar_error = err;
    return -1;
-
-  snprintf(command, 1024, "%s --batch --no-verbose --quiet --passphrase-repeat 0 --passphrase-fd %i %s %s", roar_libroar_get_path_static("bin-gpg"), pwpipe[0], para, opts);
+  }
+
+  snprintf(command, 1024, "%s --batch --no-verbose --quiet --passphrase-repeat 0 --passphrase-fd %i %s %s", bin_gpg, pwpipe[0], para, opts);
 
   write(pwpipe[1], pw, strlen(pw));
@@ -650,6 +667,8 @@
   close(pwpipe[1]);
  } else {
-  snprintf(command, 1024, "%s --no-verbose --quiet %s %s", roar_libroar_get_path_static("bin-gpg"), para, opts);
- }
+  snprintf(command, 1024, "%s --no-verbose --quiet %s %s", bin_gpg, para, opts);
+ }
+
+ roar_mm_free(bin_gpg);
 
  if ( wronly ) {
Index: roard/driver_dmx.c
===================================================================
--- roard/driver_dmx.c	(revision 5832)
+++ roard/driver_dmx.c	(revision 5895)
@@ -33,4 +33,5 @@
  int err;
  const char * dev = device;
+ char * dev_default_dmx4linux = NULL;
 
  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY, 0644) == -1 )
@@ -46,13 +47,19 @@
    dev = roar_env_get("DMX");
 
-  if ( dev == NULL )
-   dev = roar_libroar_get_path_static("dev-default-dmx4linux");
+  if ( dev == NULL ) {
+   dev_default_dmx4linux = roar_libroar_get_path("dev-default-dmx4linux", 0, NULL, NULL);
+   dev = dev_default_dmx4linux;
+  }
 
   if ( roar_vio_open_dstr(vio, dev, &def, 1) == -1 ) {
    err = roar_error;
    roar_mm_free(vio);
+   if ( dev_default_dmx4linux != NULL )
+    roar_mm_free(dev_default_dmx4linux);
    roar_error = err;
    return -1;
   }
+  if ( dev_default_dmx4linux != NULL )
+   roar_mm_free(dev_default_dmx4linux);
  } else {
   if ( roar_vio_open_fh(vio, fh) == -1 ) {
