Commit d6a99baf by Celine Mercier

Fixed a major bug with the versioning of columns that was introduced in

f6ec8ba9
parent 08f2657e
......@@ -233,11 +233,11 @@ static obiversion_t obi_get_new_version_number(OBIDMS_column_directory_p column_
return -1;
}
// Prepare the file for locking
// Reset offset to 0
if (lseek(version_file_descriptor, 0, SEEK_SET) != 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nError preparing a version file for locking");
obidebug(1, "\nError positioning offset in version file");
close(version_file_descriptor);
return -1;
}
......@@ -262,6 +262,15 @@ static obiversion_t obi_get_new_version_number(OBIDMS_column_directory_p column_
new_version_number++;
// Reset offset to 0 to write the new version number
if (lseek(version_file_descriptor, 0, SEEK_SET) != 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nError positioning offset in version file");
close(version_file_descriptor);
return -1;
}
// Write the new version number
if (write(version_file_descriptor, &new_version_number, sizeof(obiversion_t)) < ((ssize_t) sizeof(obiversion_t)))
{
......@@ -271,11 +280,11 @@ static obiversion_t obi_get_new_version_number(OBIDMS_column_directory_p column_
return -1;
}
// Prepare for unlocking
// Reset offset to 0 (TODO: why?)
if (lseek(version_file_descriptor, 0, SEEK_SET) != 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nError preparing the unlocking of a version file");
obidebug(1, "\nError positioning offset in version file");
close(version_file_descriptor);
return -1;
}
......@@ -617,7 +626,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
if (column_file_descriptor < 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nError opening a column file");
obidebug(1, "\nError opening a column file %s", column_file_name);
free(column_file_name);
return NULL;
}
......
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