X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcryptsetup.c;h=3aa822a1d020591f618e5f6e18b8faab467d65f4;hb=9c1b183c709b90e735b60294d7be00b37814645a;hp=506ce9b5c9086bf3d4fec4cd0431affc5bc139ba;hpb=b61e476f510999c687d3c76193a98aa5cd1f9a73;p=elogind.git diff --git a/src/cryptsetup.c b/src/cryptsetup.c index 506ce9b5c..3aa822a1d 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -31,6 +31,7 @@ #include "util.h" #include "strv.h" #include "ask-password-api.h" +#include "def.h" static const char *opt_type = NULL; /* LUKS1 or PLAIN */ static char *opt_cipher = NULL; @@ -207,6 +208,17 @@ finish: return mp; } +static int help(void) { + + printf("%s attach VOLUME SOURCEDEVICE [PASSWORD] [OPTIONS]\n" + "%s detach VOLUME\n\n" + "Attaches or detaches an encrypted block device.\n", + program_invocation_short_name, + program_invocation_short_name); + + return 0; +} + int main(int argc, char *argv[]) { int r = EXIT_FAILURE; struct crypt_device *cd = NULL; @@ -214,6 +226,11 @@ int main(int argc, char *argv[]) { const char *cipher = NULL, *cipher_mode = NULL, *hash = NULL, *name = NULL; char *description = NULL, *name_buffer = NULL, *mount_point = NULL; + if (argc <= 1) { + help(); + return EXIT_SUCCESS; + } + if (argc < 3) { log_error("This program requires at least two arguments."); return EXIT_FAILURE; @@ -292,7 +309,7 @@ int main(int argc, char *argv[]) { if (opt_readonly) flags |= CRYPT_ACTIVATE_READONLY; - until = now(CLOCK_MONOTONIC) + (opt_timeout > 0 ? opt_timeout : 60 * USEC_PER_SEC); + until = now(CLOCK_MONOTONIC) + (opt_timeout > 0 ? opt_timeout : DEFAULT_TIMEOUT_USEC); opt_tries = opt_tries > 0 ? opt_tries : 3; opt_key_size = (opt_key_size > 0 ? opt_key_size : 256);