Add check if input directory exist
authorTomas Mlcoch <tmlcoch@redhat.com>
Mon, 28 May 2012 07:47:29 +0000 (09:47 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Mon, 28 May 2012 07:47:29 +0000 (09:47 +0200)
src/createrepo_c.c

index 1ebbc86..badf59b 100644 (file)
@@ -264,6 +264,16 @@ int main(int argc, char **argv) {
     cmd_options->input_dir = g_strdup(in_dir);
 
 
+    // Check if inputdir exists
+
+    if (!g_file_test(cmd_options->input_dir, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_DIR)) {
+        g_warning("Directory %s must exist", cmd_options->input_dir);
+        g_free(in_dir);
+        free_options(cmd_options);
+        exit(1);
+    }
+
+
     // Check parsed arguments
 
     if (!check_arguments(cmd_options)) {