Changeset 5838:52ca1a88734e in roaraudio for libroar/config.c


Ignore:
Timestamp:
01/07/13 02:36:01 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

handle setting of server name in connection object in a better way. also added new command "servername" to roarctl to debug this a bit. This is one little step needed by ##337

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/config.c

    r5833 r5838  
    3636#include "libroar.h" 
    3737 
     38#define LEN_AUTHFILE 1024 
     39 
    3840static struct roar_libroar_config_codec * 
    3941           roar_libroar_config_codec_get_conf(int32_t codec, int create, struct roar_libroar_config * config); 
     
    4345 static struct roar_libroar_config config; 
    4446 static int    inited = 0; 
    45  static char   authfile[1024]; 
     47 static char   authfile[LEN_AUTHFILE]; 
    4648 const  char * home = roar_env_get_home(0); 
    4749 
     
    102104  config->codecs.num = 0; 
    103105 } 
     106 
     107 if ( config->x11.display != NULL ) 
     108  roar_mm_free(config->x11.display); 
     109 config->x11.display = NULL; 
     110 
     111 if ( config->daemonimage != NULL ) 
     112  roar_mm_free(config->daemonimage); 
     113 config->daemonimage = NULL; 
    104114 
    105115 return 0; 
     
    308318    roar_libroar_set_server(v); 
    309319  } else if ( !strcmp(k, "set-authfile") ) { 
    310    strncpy(config->authfile, v, 1023); 
    311    config->authfile[1023] = 0; 
     320   strncpy(config->authfile, v, LEN_AUTHFILE-1); 
     321   config->authfile[LEN_AUTHFILE-1] = 0; 
    312322  } else if ( !strcmp(k, "x11-display") ) { 
    313    config->x11.display = v; 
     323   if ( config->x11.display != NULL ) 
     324    roar_mm_free(config->x11.display); 
     325   config->x11.display = roar_mm_strdup(v); 
    314326  } else if ( !strcmp(k, "daemonimage") ) { 
    315    config->daemonimage = v; 
     327   if ( config->daemonimage != NULL ) 
     328    roar_mm_free(config->daemonimage); 
     329   config->daemonimage = roar_mm_strdup(v); 
    316330  } else if ( !strcmp(k, "serverflags") ) { 
    317331   if ( !strcmp(v, "nonblock") ) { 
Note: See TracChangeset for help on using the changeset viewer.