From 2d97659a6bd1316a5d026ac14db307e00e1d8b45 Mon Sep 17 00:00:00 2001 From: Daniel Roethlisberger Date: Sun, 23 Nov 2014 15:46:37 +0100 Subject: [PATCH] Check if args to -j and -S are directories --- main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.c b/main.c index d24d461..d72b5ab 100644 --- a/main.c +++ b/main.c @@ -483,6 +483,12 @@ main(int argc, char *argv[]) oom_die(argv0); break; case 'j': + if (!sys_isdir(optarg)) { + fprintf(stderr, "%s: '%s' is not a " + "directory\n", + argv0, optarg); + exit(EXIT_FAILURE); + } if (opts->jaildir) free(opts->jaildir); opts->jaildir = strdup(optarg); @@ -506,6 +512,12 @@ main(int argc, char *argv[]) opts->contentlog_isspec = 0; break; case 'S': + if (!sys_isdir(optarg)) { + fprintf(stderr, "%s: '%s' is not a " + "directory\n", + argv0, optarg); + exit(EXIT_FAILURE); + } if (opts->contentlog) free(opts->contentlog); opts->contentlog = strdup(optarg);