Check if args to -j and -S are directories

This commit is contained in:
Daniel Roethlisberger 2014-11-23 15:46:37 +01:00
parent 86397dac89
commit 2d97659a6b

12
main.c
View File

@ -483,6 +483,12 @@ main(int argc, char *argv[])
oom_die(argv0); oom_die(argv0);
break; break;
case 'j': case 'j':
if (!sys_isdir(optarg)) {
fprintf(stderr, "%s: '%s' is not a "
"directory\n",
argv0, optarg);
exit(EXIT_FAILURE);
}
if (opts->jaildir) if (opts->jaildir)
free(opts->jaildir); free(opts->jaildir);
opts->jaildir = strdup(optarg); opts->jaildir = strdup(optarg);
@ -506,6 +512,12 @@ main(int argc, char *argv[])
opts->contentlog_isspec = 0; opts->contentlog_isspec = 0;
break; break;
case 'S': case 'S':
if (!sys_isdir(optarg)) {
fprintf(stderr, "%s: '%s' is not a "
"directory\n",
argv0, optarg);
exit(EXIT_FAILURE);
}
if (opts->contentlog) if (opts->contentlog)
free(opts->contentlog); free(opts->contentlog);
opts->contentlog = strdup(optarg); opts->contentlog = strdup(optarg);