mardi 29 avril 2014

old libconfig version support of config_setting_get_string


Vote count:

0




I have a program in C that was running perfectly in a debian box. I have been asked to compile and run it on CentOs 6.5. Everything compiles perfectly except the part where I try to get a value from a configuration file. Code is writen like this:



char config_file[150]="file.conf";
config_t cfg;
config_setting_t *ssl_xor_key;
char xkey[256];
ssl_xor_key = config_lookup(&cfg, "ssl.xor.key");
strcpy(xkey,config_setting_get_string(ssl_xor_key));


The config file contains this:



ssl:
{
xor:
{
key="textexttextexttextext";
};
};


When the program arrives to the config_setting_get_string it crashes. I have tried to just set the string in the strcpy command and it works. I have seen this on the /var/log/messages:



kernel: mysql-proxy[9808]: segfault at 8 ip 00007f3ba9d53d12 sp 00007f3baab8a0d8 error 4 in libconfig.so.8.0.0[7f3ba9d51000+a000]


I have seen that while the original Debian box had libconfig 1.4.9, CentOs most updated version is 1.3.2. I am not sure if the command is suported in that version, as I was not able to find the documentation of the old version.


I also have tried to compile the newest version on the Centos Box but I get errors on the process, so I think it is not suported.


Any idea of what can be the solution?



asked 19 secs ago






Aucun commentaire:

Enregistrer un commentaire