Check device mapper communication and warn user in case the communication fails. Thanks to Milan Broz.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@31 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Clemens Fruhwirth
2008-09-11 09:10:55 +00:00
parent 8003974484
commit 0ac25b6c83
2 changed files with 11 additions and 1 deletions

View File

@@ -38,9 +38,16 @@ static void set_dm_error(int level, const char *file, int line,
va_end(va);
}
static int _dm_simple(int task, const char *name);
static int dm_init(void)
{
dm_log_init(set_dm_error);
if (!_dm_simple(DM_DEVICE_LIST_VERSIONS, "test")) {
set_error("Cannot communicate with device-mapper. Is the dm_mod module loaded?");
return -1;
}
return 1; /* unsafe memory */
}

View File

@@ -705,7 +705,10 @@ static int crypt_job(int (*job)(int arg, struct setup_backend *backend,
backend = get_setup_backend(default_backend);
setup_enter(backend,options->icb->log);
if (setup_enter(backend,options->icb->log) < 0) {
r = -ENOSYS;
goto out;
}
if (!backend) {
set_error("No setup backend available");