rawfile.c, no premature exit if directory not available, if just file name without path, simply hand it back.

This commit is contained in:
h_vogt 2017-02-26 11:42:01 +01:00 committed by rlar
parent d0607f5524
commit 629000f039
1 changed files with 13 additions and 12 deletions

View File

@ -847,10 +847,8 @@ set_output_path(char *filename)
if(!dirloc) if(!dirloc)
dirloc = strrchr(ret, DIR_TERM_LINUX); dirloc = strrchr(ret, DIR_TERM_LINUX);
#endif #endif
if (dirloc) if (dirloc) {
fpath = copy_substring(ret, dirloc); fpath = copy_substring(ret, dirloc);
else
fpath = copy(ret);
/* test if path exists */ /* test if path exists */
if (stat(fpath, &st) == 0) { if (stat(fpath, &st) == 0) {
tfree(fpath); tfree(fpath);
@ -858,8 +856,11 @@ set_output_path(char *filename)
} }
else { else {
fprintf(cp_err, "Error: Output path %s does not exist\n", fpath); fprintf(cp_err, "Error: Output path %s does not exist\n", fpath);
tfree(ret);
tfree(fpath); tfree(fpath);
controlled_exit(1); return ret; /* fopen will catch this error */
} }
}
/* no path, just use the file name */
else
return ret;
} }