(unsigned)target->version[1],
(unsigned)target->version[2]);
}
- target = (void *) target + target->next;
+ target = (struct dm_versions *)((char *) target + target->next);
} while (last_target != target);
dm_task_destroy(dmt);
struct dm_task *dmt;
struct dm_info dmi;
uint64_t start, length, val64;
- char *target_type, *params, *rcipher, *key_, *rdevice, *endp, buffer[3], *tmp_uuid;
+ char *target_type, *params, *rcipher, *key_, *rdevice, *endp, buffer[3];
+ const char *tmp_uuid;
void *next = NULL;
int i, r = -EINVAL;
if (suspended)
*suspended = dmi.suspended;
- if (uuid && (tmp_uuid = (char*)dm_task_get_uuid(dmt)) &&
+ if (uuid && (tmp_uuid = dm_task_get_uuid(dmt)) &&
!strncmp(tmp_uuid, DM_UUID_PREFIX, DM_UUID_PREFIX_LEN))
*uuid = strdup(tmp_uuid + DM_UUID_PREFIX_LEN);
int crypt_luksUUID(struct crypt_options *options)
{
struct crypt_device *cd = NULL;
- char *uuid;
+ const char *uuid;
int r;
r = _crypt_init(&cd, CRYPT_LUKS1, options, 1, 0);
if (r)
return r;
- uuid = (char *)crypt_get_uuid(cd);
+ uuid = crypt_get_uuid(cd);
log_std(cd, "%s\n", uuid ?: "");
crypt_free(cd);
return 0;
if (!data)
return;
- alloc = data - offsetof(struct safe_allocation, data);
+ alloc = (struct safe_allocation *)
+ ((char *)data - offsetof(struct safe_allocation, data));
memset(data, 0, alloc->size);
if (new_data && data) {
- alloc = data - offsetof(struct safe_allocation, data);
+ alloc = (struct safe_allocation *)
+ ((char *)data - offsetof(struct safe_allocation, data));
if (size > alloc->size)
size = alloc->size;
if(read_stdin && isatty(STDIN_FILENO))
return crypt_get_key_tty(prompt, key, key_size, timeout, verify, cd);
- if (keyfile_size_max < 0) {
- log_err(cd, _("Negative keyfile size not permitted.\n"));
- return -EINVAL;
- }
-
if (read_stdin)
log_dbg("STDIN descriptor passphrase entry requested.");
else
if(S_ISREG(st.st_mode)) {
regular_file = 1;
/* known keyfile size, alloc it in one step */
- if (st.st_size >= keyfile_size_max)
+ if ((size_t)st.st_size >= keyfile_size_max)
buflen = keyfile_size_max;
else
buflen = st.st_size;
static int opt_verbose = 0;
static int opt_debug = 0;
-static char *opt_cipher = NULL;
-static char *opt_hash = NULL;
+static const char *opt_cipher = NULL;
+static const char *opt_hash = NULL;
static int opt_verify_passphrase = 0;
-static char *opt_key_file = NULL;
-static char *opt_master_key_file = NULL;
-static char *opt_header_backup_file = NULL;
-static char *opt_uuid = NULL;
+static const char *opt_key_file = NULL;
+static const char *opt_master_key_file = NULL;
+static const char *opt_header_backup_file = NULL;
+static const char *opt_uuid = NULL;
static int opt_key_size = 0;
static long opt_keyfile_size = 0;
static long opt_new_keyfile_size = 0;
usage(popt_context, EXIT_SUCCESS, NULL, NULL);
}
-static void _dbg_version_and_cmd(int argc, char **argv)
+static void _dbg_version_and_cmd(int argc, const char **argv)
{
int i;
return r;
}
-int main(int argc, char **argv)
+int main(int argc, const char **argv)
{
static char *popt_tmp;
static struct poptOption popt_help_options[] = {
};
poptContext popt_context;
struct action_type *action;
- char *aname;
+ const char *aname;
int r;
const char *null_action_argv[] = {NULL};
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- popt_context = poptGetContext(PACKAGE, argc, (const char **)argv,
- popt_options, 0);
+ popt_context = poptGetContext(PACKAGE, argc, argv, popt_options, 0);
poptSetOtherOptionHelp(popt_context,
N_("[OPTION...] <action> <action-specific>]"));
exit(EXIT_SUCCESS);
}
- if (!(aname = (char *)poptGetArg(popt_context)))
+ if (!(aname = poptGetArg(popt_context)))
usage(popt_context, EXIT_FAILURE, _("Argument <action> missing."),
poptGetInvocationName(popt_context));
for(action = action_types; action->type; action++)
if (opt_key_file)
log_err(_("Option --key-file takes precedence over specified key file argument.\n"));
else
- opt_key_file = (char*)action_argv[1];
+ opt_key_file = action_argv[1];
}
if (opt_keyfile_size < 0 || opt_new_keyfile_size < 0 || opt_key_size < 0) {