Change License from GPLv2 only to GPLv2+ ("or any later").
[platform/upstream/cryptsetup.git] / src / utils_tools.c
index 86836ca..ca39339 100644 (file)
@@ -4,10 +4,12 @@
  * Copyright (C) 2004, Christophe Saout <christophe@saout.de>
  * Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
  * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2012, Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -35,6 +37,11 @@ static void int_handler(int sig __attribute__((__unused__)))
        quit++;
 }
 
+int tools_signals_blocked(void)
+{
+       return signals_blocked;
+}
+
 void set_int_block(int block)
 {
        sigset_t signals_open;
@@ -67,28 +74,6 @@ void check_signal(int *r)
                *r = -EINTR;
 }
 
-/* crypt_get_key() with signal handler */
-int tools_get_key(const char *prompt,
-                 char **key, size_t *key_size,
-                 size_t keyfile_offset, size_t keyfile_size_max,
-                 const char *key_file,
-                 int timeout, int verify,
-                 struct crypt_device *cd)
-{
-       int r, block;
-
-       block = signals_blocked;
-       if (block)
-               set_int_block(0);
-
-       r = crypt_get_key(prompt, key, key_size, keyfile_offset,
-                         keyfile_size_max, key_file, timeout, verify, cd);
-       if (block && !quit)
-               set_int_block(1);
-
-       return r;
-}
-
 __attribute__((format(printf, 5, 6)))
 void clogger(struct crypt_device *cd, int level, const char *file, int line,
             const char *format, ...)
@@ -151,7 +136,7 @@ int yesDialog(const char *msg, void *usrptr __attribute__((unused)))
        size_t size = 0;
        int r = 1, block;
 
-       block = signals_blocked;
+       block = tools_signals_blocked();
        if (block)
                set_int_block(0);