Commit 1da6aac1 by Celine Mercier

C: patch for failed creation of AVL with errno EEXIST

parent 159803b4
...@@ -1725,16 +1725,32 @@ int obi_close_column(OBIDMS_column_p column) ...@@ -1725,16 +1725,32 @@ int obi_close_column(OBIDMS_column_p column)
int obi_clone_column_indexer(OBIDMS_column_p column) int obi_clone_column_indexer(OBIDMS_column_p column)
{ {
char* new_indexer_name; char* new_indexer_name;
int i;
new_indexer_name = obi_build_indexer_name((column->header)->name, (column->header)->version); i=0;
if (new_indexer_name == NULL) while (true) // find avl name not already used
return -1;
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
if (column->indexer == NULL)
{ {
obidebug(1, "\nError cloning a column's indexer to make it writable"); new_indexer_name = obi_build_indexer_name((column->header)->name, ((column->header)->version)+i);
return -1; if (new_indexer_name == NULL)
return -1;
column->indexer = obi_clone_indexer(column->indexer, new_indexer_name); // TODO Need to lock this somehow?
if (column->indexer == NULL)
{
if (errno == EEXIST)
{
free(new_indexer_name);
i++;
}
else
{
free(new_indexer_name);
obidebug(1, "\nError cloning a column's indexer to make it writable");
return -1;
}
}
else
break;
} }
strcpy((column->header)->indexer_name, new_indexer_name); strcpy((column->header)->indexer_name, new_indexer_name);
...@@ -2415,16 +2431,20 @@ char* obi_get_formatted_elements_names(OBIDMS_column_p column) ...@@ -2415,16 +2431,20 @@ char* obi_get_formatted_elements_names(OBIDMS_column_p column)
} }
char* obi_column_formatted_infos(OBIDMS_column_p column) char* obi_column_formatted_infos(OBIDMS_column_p column, bool detailed)
{ {
char* column_infos; char* column_infos = NULL;
char* elt_names; char* elt_names = NULL;
char* column_name = NULL;
column_infos = malloc(1024 * sizeof(char)); // should be in view.c because alias exists in the context of view
column_infos = malloc(2048 * sizeof(char)); // TODO
elt_names = obi_get_formatted_elements_names(column); elt_names = obi_get_formatted_elements_names(column);
// "column_name, data type: OBI_TYPE, element names: [formatted element names](, all comments)"
free(elt_names); free(elt_names);
return column_infos; return column_infos;
} }
......
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