Index: libroar/basic.c
===================================================================
--- libroar/basic.c	(revision 5745)
+++ libroar/basic.c	(revision 5754)
@@ -69,5 +69,5 @@
  // we keep this step to be compatible with older versions.
  if ( daemonimage == NULL || *daemonimage == 0 ) {
-  daemonimage = getenv("ROAR_DAEMONIMAGE");
+  daemonimage = roar_env_get("ROAR_DAEMONIMAGE");
   if ( daemonimage != NULL ) {
    ROAR_WARN("_start_server(*): Usage of $ROAR_DAEMONIMAGE is obsolete. Use ROAR_OPTIONS=daemonimage:...");
@@ -275,5 +275,5 @@
 #if defined(ROAR_HAVE_UNIX)
  char user_sock[128];
- char * roar_server;
+ const char * roar_server;
 #endif
 #if defined(ROAR_HAVE_LIBSLP) || !defined(ROAR_TARGET_MICROCONTROLLER)
@@ -309,5 +309,5 @@
 
  if ( server == NULL || *server == 0 )
-  server = getenv("ROAR_SERVER");
+  server = roar_env_get("ROAR_SERVER");
 
 #ifdef ROAR_HAVE_LIBX11
@@ -344,5 +344,5 @@
 #ifdef ROAR_HAVE_UNIX
 #ifndef ROAR_TARGET_MICROCONTROLLER
-  roar_server = getenv("HOME");
+  roar_server = roar_env_get("HOME");
 #else
   roar_server = NULL;
Index: libroar/config.c
===================================================================
--- libroar/config.c	(revision 5747)
+++ libroar/config.c	(revision 5754)
@@ -76,13 +76,17 @@
  struct roar_libroar_config * config = roar_libroar_get_config_ptr();
  static int inited = 0;
- char * next;
+ const char * next;
+ char * buf;
 
  if ( !inited ) {
   inited++; // we do this early so we can use ROAR_{DBG,INFO,WARN,ERR}() in roar_libroar_config_parse().
 
-  next = getenv("ROAR_OPTIONS");
+  next = roar_env_get("ROAR_OPTIONS");
 
   if ( next != NULL ) {
-   roar_libroar_config_parse(next, " ");
+   if ( (buf = roar_mm_strdup(next)) != NULL ) {
+    roar_libroar_config_parse(buf, " ");
+    roar_mm_free(buf);
+   }
   }
  }
Index: libroar/enumdev.c
===================================================================
--- libroar/enumdev.c	(revision 5381)
+++ libroar/enumdev.c	(revision 5754)
@@ -115,5 +115,5 @@
   _add(new);
 
-  new = getenv("ROAR_SERVER");
+  new = roar_env_get("ROAR_SERVER");
   _add(new);
 
@@ -126,7 +126,7 @@
 #endif
 
-  new = getenv("SSH_CLIENT");
+  new = roar_env_get("SSH_CLIENT");
   if ( new == NULL )
-   new = getenv("SSH_CONNECTION");
+   new = roar_env_get("SSH_CONNECTION");
 
   if ( new != NULL ) {
Index: libroar/env.c
===================================================================
--- libroar/env.c	(revision 5752)
+++ libroar/env.c	(revision 5754)
@@ -86,5 +86,5 @@
 
 const char * roar_env_get_home(int level) {
- const char * home = getenv("HOME");
+ const char * home = roar_env_get("HOME");
 
  (void)level;
Index: libroar/file.c
===================================================================
--- libroar/file.c	(revision 5381)
+++ libroar/file.c	(revision 5754)
@@ -86,5 +86,5 @@
  const char * k;
 
- if ( (k = getenv("CDDA_DEVICE")) != NULL )
+ if ( (k = roar_env_get("CDDA_DEVICE")) != NULL )
   return k;
 
Index: libroar/pinentry.c
===================================================================
--- libroar/pinentry.c	(revision 5619)
+++ libroar/pinentry.c	(revision 5754)
@@ -45,5 +45,5 @@
 #endif
 
-int roar_pinentry_open (struct roar_pinentry * pe, int flags, char * display, char * tty, char * term) {
+int roar_pinentry_open (struct roar_pinentry * pe, int flags, const char * display, const char * tty, const char * term) {
 #ifdef _CAN_OPERATE
  int in[2], out[2];
@@ -57,5 +57,5 @@
 
  if ( display == NULL )
-  display = getenv("DISPLAY");
+  display = roar_env_get("DISPLAY");
 
  if ( display == NULL )
@@ -73,5 +73,5 @@
 
  if ( term == NULL )
-  term = getenv("TERM");
+  term = roar_env_get("TERM");
 
  if ( term == NULL )
Index: libroar/socket.c
===================================================================
--- libroar/socket.c	(revision 5745)
+++ libroar/socket.c	(revision 5754)
@@ -401,5 +401,5 @@
 
 int roar_socket_connect (int type, const char * host, int port) {
- char * proxy_type = getenv("ROAR_PROXY");
+ const char * proxy_type = roar_env_get("ROAR_PROXY");
 
  ROAR_DBG("roar_socket_connect(host='%s', port=%i) = ?", host, port);
@@ -874,8 +874,8 @@
  int    proxy_port = -1;
  char   proxy_host[ROAR_SOCKET_MAX_HOSTNAMELEN];
- char * proxy_addr = NULL;
+ const char * proxy_addr = NULL;
  int    i;
  int    fh = -1;
- char * user = NULL, * pw = NULL, * opts = NULL;
+ const char * user = NULL, * pw = NULL, * opts = NULL;
  char * sep;
  int    no_fh = 0;
@@ -895,5 +895,5 @@
 
  if ( user == NULL )
-  user = getenv("USER");
+  user = roar_env_get("USER");
 
  // TODO: change this so we support listen() proxys (ssh -R)
@@ -902,5 +902,5 @@
 
  if ( !strncmp(proxy_type, "socks", 5) ) {
-  proxy_addr = getenv("socks_proxy");
+  proxy_addr = roar_env_get("socks_proxy");
 
   proxy_port = 9050; // TOR's default port
@@ -908,6 +908,6 @@
   proxy_port = 8080;
 
-  if ( (proxy_addr = getenv("http_proxy")) == NULL )
-   proxy_addr = getenv("https_proxy");
+  if ( (proxy_addr = roar_env_get("http_proxy")) == NULL )
+   proxy_addr = roar_env_get("https_proxy");
 
   if ( proxy_addr == NULL )
@@ -918,5 +918,5 @@
  } else if ( !strncmp(proxy_type, "ssh", 3) ) {
   proxy_port = 22;
-  proxy_addr = getenv("ssh_proxy");
+  proxy_addr = roar_env_get("ssh_proxy");
   no_fh      = 1;
  }
@@ -1105,5 +1105,5 @@
 #ifdef ROAR_HAVE_BIN_SSH
 static int roar_socket_open_ssh    (int mode, int fh, const char * host, int port, const char * user, const char * pw, const char * opts) {
- char * proxy_addr = getenv("ssh_proxy");
+ const char * proxy_addr = roar_env_get("ssh_proxy");
  char * sep;
  char   cmd[1024] = {0}, rcmd[1024] = {0};
