Minor changes to make the creation of files and directories cleaner

This commit is contained in:
Celine Mercier
2015-11-09 15:22:01 +01:00
parent b37bd8f21c
commit 65c1b1e8b2
2 changed files with 5 additions and 2 deletions

View File

@ -338,7 +338,7 @@ static obiversion_t create_version_file(OBIDMS_column_directory_p column_directo
return -1;
// Get the file descriptor associated to the version file
version_file_descriptor = openat(column_directory->dir_fd, version_file_name, O_RDWR | O_CREAT, 0777);
version_file_descriptor = openat(column_directory->dir_fd, version_file_name, O_RDWR | O_CREAT | O_EXCL, 0777);
if (version_file_descriptor < 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
@ -660,7 +660,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
}
// Open the column file
column_file_descriptor = openat(column_directory->dir_fd, column_file_name, O_RDWR | O_CREAT, 0777);
column_file_descriptor = openat(column_directory->dir_fd, column_file_name, O_RDWR | O_CREAT | O_EXCL, 0777);
if (column_file_descriptor < 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);