If an error occurs when cloning a column, the new cloned file is now
deleted
This commit is contained in:
@ -835,7 +835,7 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms, const char* column_name, obiversio
|
||||
// Check endianness?
|
||||
|
||||
// Compute data size from the informations in the header
|
||||
data_size = ((column->header)->line_count) * sizeof((column->header)->data_type); // TODO line_count for tests, change to lines_used later
|
||||
data_size = ((column->header)->line_count) * sizeof((column->header)->data_type);
|
||||
|
||||
column->data = mmap(NULL,
|
||||
data_size,
|
||||
@ -900,8 +900,10 @@ OBIDMS_column_p obi_clone_column(OBIDMS_p dms, const char* column_name, obiversi
|
||||
{
|
||||
obi_set_errno(OBICOL_UNKNOWN_ERROR);
|
||||
obidebug(1, "\nError creating the new column when cloning a column");
|
||||
// TODO the new file should be deleted
|
||||
return NULL;
|
||||
// The new file is deleted
|
||||
const char* column_file_name = build_column_file_name(column_name, version_number);
|
||||
if (remove(column_file_name) < 0)
|
||||
obidebug(1, "\nError deleting a bad cloned file");
|
||||
}
|
||||
|
||||
(new_column->header)->cloned_from = version_number;
|
||||
|
Reference in New Issue
Block a user