ctdb-daemon: Exit with error if a database directory does not exist
[amitay/samba.git] / ctdb / server / ctdbd.c
index a2870d0d11135e4c57bdc9551d99a849c39d3399..7e71d6e82725c9c8b3006e6a31966a6becb870e6 100644 (file)
@@ -311,8 +311,28 @@ int main(int argc, const char *argv[])
         */
 
        ctdb->db_directory = ctdb_config.dbdir_volatile;
+       ok = directory_exist(ctdb->db_directory);
+       if (! ok) {
+               D_ERR("Volatile database directory %s does not exist\n",
+                     ctdb->db_directory);
+               goto fail;
+       }
+
        ctdb->db_directory_persistent = ctdb_config.dbdir_persistent;
+       ok = directory_exist(ctdb->db_directory_persistent);
+       if (! ok) {
+               D_ERR("Persistent database directory %s does not exist\n",
+                     ctdb->db_directory_persistent);
+               goto fail;
+       }
+
        ctdb->db_directory_state = ctdb_config.dbdir_state;
+       ok = directory_exist(ctdb->db_directory_state);
+       if (! ok) {
+               D_ERR("State database directory %s does not exist\n",
+                     ctdb->db_directory_state);
+               goto fail;
+       }
 
        if (ctdb_config.lock_debug_script != NULL) {
                ret = setenv("CTDB_DEBUG_LOCKS",