Fixes support of file names starting or ending with a space.

This commit is contained in:
Andrea Mazzoleni 2011-05-24 21:03:30 +02:00
parent 58f191ef1f
commit 35f3c092ed
8 changed files with 65 additions and 23 deletions

2
scan.c
View file

@ -225,7 +225,7 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, s
continue;
/* check for not supported file names, limitation derived from the content file format */
if (name[0] == 0 || isspace(name[0]) || isspace(name[strlen(name)-1])) {
if (name[0] == 0 || strchr(name, '\n') != 0 || name[strlen(name)-1] == '\r') {
fprintf(stderr, "Unsupported name '%s' in file '%s'.\n", name, path_next);
exit(EXIT_FAILURE);
}