/*
* cryptsetup - setup cryptographic volumes for dm-crypt
*
- * Copyright (C) 2004, Christophe Saout <christophe@saout.de>
+ * Copyright (C) 2004, Jana Saout <jana@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
+ * Copyright (C) 2009-2014, 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
if(isatty(STDIN_FILENO) && !opt_batch_mode) {
log_std("\nWARNING!\n========\n");
log_std("%s\n\nAre you sure? (Type uppercase yes): ", msg);
+ fflush(stdout);
if(getline(&answer, &size, stdin) == -1) {
r = 0;
/* Aborted by signal */
void show_status(int errcode)
{
- char error[256], *error_;
+ char error[256];
if(!opt_verbose)
return;
crypt_get_error(error, sizeof(error));
- if (!error[0]) {
- error_ = strerror_r(-errcode, error, sizeof(error));
- if (error_ != error) {
+ if (*error) {
+#ifdef STRERROR_R_CHAR_P /* GNU-specific strerror_r */
+ char *error_ = strerror_r(-errcode, error, sizeof(error));
+ if (error_ != error)
strncpy(error, error_, sizeof(error));
- error[sizeof(error) - 1] = '\0';
- }
+#else /* POSIX strerror_r variant */
+ if (strerror_r(-errcode, error, sizeof(error)))
+ *error = '\0';
+#endif
+ error[sizeof(error) - 1] = '\0';
}
log_err(_("Command failed with code %i"), -errcode);