Commit 5af6f93d authored by Arnaud Blanchard's avatar Arnaud Blanchard

Fix blc_channel_get_info_with_name used by blc_channel::open

parent 405ed5ae
......@@ -69,7 +69,7 @@ blc_channel::blc_channel(blc_channel const &channel):blc_array(channel),id(chann
STRCPY(parameter, channel.parameter);
}
blc_channel::blc_channel(blc_channel &&channel):blc_array(channel),id(channel.id), fd(channel.fd), sem_new_data(channel.sem_new_data), sem_ack_data(channel.sem_ack_data) {
blc_channel::blc_channel(blc_channel &&channel):blc_array(channel), id(channel.id), fd(channel.fd), sem_new_data(channel.sem_new_data), sem_ack_data(channel.sem_ack_data) {
STRCPY(name, channel.name);
STRCPY(parameter, channel.parameter);
}
......@@ -346,6 +346,7 @@ int blc_channel::conflict(const char *new_name){
///Open an existing channel
void blc_channel::open(int access_mode){
blc_channel channel_info;
char name_tmp[NAME_MAX];
int sync_new_data=0, sync_ack_data=0;
......
......@@ -180,27 +180,24 @@ int blc_channel_create_or_open(blc_channel *channel, const char *name, int mode,
}
//Search for channel name whatever is start by /,: ,^ or .
int blc_channel_get_info_with_name(blc_channel *info, char const *name)
{
int blc_channel_get_info_with_name(blc_channel *info, char const *name){
blc_channel tmp_info;
FILE *file;
int id=-1;
file = fopen(BLC_CHANNELS_LIST_PATH, "r");
if (file == NULL)
{
if (file == NULL){
if (errno==ENOENT) return -1;
else EXIT_ON_SYSTEM_ERROR("opening '" BLC_CHANNELS_LIST_PATH"'.");
}
while(fscanf(file, "%*[ \t\n]")!=EOF)
{
info->fscan_info(file, 1);
if ((info->id != -1) && (strcmp(info->name+1, name+1)==0)) //We do not test first char '/' or '.'
{
id=info->id;
while(fscanf(file, "%*[ \t\n]")!=EOF){
tmp_info.fscan_info(file, 1);
if ((tmp_info.id != -1) && (strcmp(tmp_info.name+1, name+1)==0)){ //We do not test first char '/' or '.'
id=tmp_info.id;
*info=tmp_info;
break;
}
else FREE(info->dims);
}
fclose(file);
return id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment