diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-05-07 23:14:06 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-05-07 23:14:06 -0400 |
commit | 1760d167b2c0f91069a8b6e4a8fef1a5bc0f9ed1 (patch) | |
tree | 8a055eed2e00a4a166eb4b5efae28bace7ebd4d4 /e2fsck | |
parent | 05950620a807621e57008acb54602287ad768785 (diff) | |
download | e2fsprogs-1760d167b2c0f91069a8b6e4a8fef1a5bc0f9ed1.tar.gz |
e2fsck: make the "fs is mounted; continue?" prompt more paranoid
A user received the "file system is mounted; do you really want to
continue" prompt, and then instead of typing "n" for no, forgot that
he hadn't declined to continuation question, and typed the up-arrow
key, which in his locale, the 'A' in "^[[A" was interpreted as "yes",
and he lost data.
This was clearly the user's fault, but to make e2fsck a bit safer
against user stupidity/carelessness, we will change the "fs is
mounted; continue?" prompt to default to no, and treat the escape
character (along with the return and space characters, currently) as a
request for the default answer.
Addresses-Debian-Bug: #619859
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck')
-rw-r--r-- | e2fsck/unix.c | 2 | ||||
-rw-r--r-- | e2fsck/util.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 624e11b5..f4792a54 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -232,7 +232,7 @@ static void check_mount(e2fsck_t ctx) printf(_("\n\n\007\007\007\007WARNING!!! " "The filesystem is mounted. If you continue you ***WILL***\n" "cause ***SEVERE*** filesystem damage.\007\007\007\n\n")); - cont = ask_yn(_("Do you really want to continue"), -1); + cont = ask_yn(_("Do you really want to continue"), 0); if (!cont) { printf (_("check aborted.\n")); exit (0); diff --git a/e2fsck/util.c b/e2fsck/util.c index 56c6b354..6c3117da 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -180,7 +180,7 @@ int ask_yn(const char * string, int def) def = 0; break; } - else if ((c == ' ' || c == '\n') && (def != -1)) + else if ((c == 27 || c == ' ' || c == '\n') && (def != -1)) break; } if (def) |