Adds missing / in mount point specification

Adds example configuration file
This commit is contained in:
Andrea Mazzoleni 2011-03-12 10:23:42 +01:00
parent 496971e9c9
commit 7c64ee26f9
7 changed files with 51 additions and 27 deletions

13
elem.c
View file

@ -96,6 +96,19 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir)
disk = malloc_nofail(sizeof(struct snapraid_disk));
snprintf(disk->name, sizeof(disk->name), "%s", name);
snprintf(disk->dir, sizeof(disk->dir), "%s", dir);
/* ensure that the dir terminate with "/" if it isn't empty */
if (disk->dir[0] != 0) {
char last = disk->dir[strlen(disk->dir) - 1];
if (last != '/'
#ifdef _WIN32
&& last != '\\'
#endif
) {
snprintf(disk->dir, sizeof(disk->dir), "%s/", dir);
}
}
disk->first_free_block = 0;
tommy_list_init(&disk->filelist);
tommy_hashdyn_init(&disk->fileset);