Changeset 5754:b23d79c13370 in roaraudio for libroar/config.c


Ignore:
Timestamp:
11/16/12 16:49:56 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

avoid getenv() and use more portable roar_env_get(). Also improved security as we enfore const now on bufferes obtained from the env.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/config.c

    r5747 r5754  
    7676 struct roar_libroar_config * config = roar_libroar_get_config_ptr(); 
    7777 static int inited = 0; 
    78  char * next; 
     78 const char * next; 
     79 char * buf; 
    7980 
    8081 if ( !inited ) { 
    8182  inited++; // we do this early so we can use ROAR_{DBG,INFO,WARN,ERR}() in roar_libroar_config_parse(). 
    8283 
    83   next = getenv("ROAR_OPTIONS"); 
     84  next = roar_env_get("ROAR_OPTIONS"); 
    8485 
    8586  if ( next != NULL ) { 
    86    roar_libroar_config_parse(next, " "); 
     87   if ( (buf = roar_mm_strdup(next)) != NULL ) { 
     88    roar_libroar_config_parse(buf, " "); 
     89    roar_mm_free(buf); 
     90   } 
    8791  } 
    8892 } 
Note: See TracChangeset for help on using the changeset viewer.