Modified some signatures

This commit is contained in:
2024-02-17 02:18:16 +01:00
parent ab244698c5
commit a2339d7515
6 changed files with 32 additions and 50 deletions

View File

@@ -62,34 +62,3 @@ Result entry_exists(const char* entry_id, bool* out_exists) {
return SUCCESS;
}
Result add_entry(const char* entry_id) {
// Check if the entry already exists
bool exists;
Result result = entry_exists(entry_id, &exists);
if (result != SUCCESS)
return result;
if (exists) {
log_message(LOG_LEVEL_ERROR, "Entry '%s' already exists.", entry_id);
return FAILURE;
}
// Create the entry directory
char* path;
result = get_entry_path(entry_id, &path);
if (result != SUCCESS)
return result;
int result_code = mkdir(path, 0755);
free(path);
// Check if the operation failed
if (result_code != 0) {
log_message(LOG_LEVEL_ERROR, "Failed to create entry '%s' (%s).", entry_id, strerror(errno));
return FAILURE;
}
return SUCCESS;
}