mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
When reading the configuration checks if a disk name is duplicated.
This commit is contained in:
parent
7d938f874d
commit
07d5027936
1 changed files with 12 additions and 0 deletions
12
state.c
12
state.c
|
|
@ -223,6 +223,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
{
|
||||
STREAM* f;
|
||||
unsigned line;
|
||||
tommy_node* i;
|
||||
|
||||
state->verbose = verbose;
|
||||
state->gui = gui;
|
||||
|
|
@ -472,6 +473,17 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* check if the disk name already exists */
|
||||
for(i=state->disklist;i!=0;i=i->next) {
|
||||
disk = i->data;
|
||||
if (strcmp(disk->name, buffer) == 0)
|
||||
break;
|
||||
}
|
||||
if (i) {
|
||||
fprintf(stderr, "Duplicate disk name '%s' at line %u\n", buffer, line);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
disk = disk_alloc(buffer, dir, st.st_dev);
|
||||
|
||||
tommy_list_insert_tail(&state->disklist, &disk->node, disk);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue