Rename without_activation to test_passphrase.
[platform/upstream/cryptsetup.git] / src / cryptsetup_reencrypt.c
index 03d6d21..df937c1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * cryptsetup-reencrypt - crypt utility for offline re-encryption
  *
- * Copyright (C) 2012 Milan Broz All rights reserved.
+ * Copyright (C) 2012, Milan Broz All rights reserved.
  * Copyright (C) 2012, Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
@@ -317,7 +317,7 @@ static int create_empty_header(const char *new_file, const char *old_file,
 
        log_dbg("Creating empty file %s of size %lu.", new_file, (unsigned long)size);
 
-       if (!(buf = malloc(size)))
+       if (!size || !(buf = malloc(size)))
                return -ENOMEM;
        memset(buf, 0, size);
 
@@ -1014,7 +1014,7 @@ static int initialize_passphrase(struct reenc_ctx *rc, const char *device)
 
        log_dbg("Passhrases initialization.");
 
-       if (opt_new) {
+       if (opt_new && !rc->in_progress) {
                r = init_passphrase1(rc, cd, _("Enter new LUKS passphrase: "), 0, 0);
                return r > 0 ? 0 : r;
        }