[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/9] parted: fix EOF and ctrl-c handling
From: |
Phillip Susi |
Subject: |
[PATCH 1/9] parted: fix EOF and ctrl-c handling |
Date: |
Sun, 30 Jun 2013 23:11:53 -0400 |
feof() seems to not detect EOF after readline() hits it, so parted went
into an infinite loop prompting for input on EOF. Change test to use the
got_ctrl_c variable instead, which is set when readline hits EOF and
returns NULL. This also makes parted properly exit on ctrl-c.
---
NEWS | 4 ++++
parted/ui.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 98f7c6e..5b76b4d 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ GNU parted NEWS -*- outline
-*-
** Bug Fixes
+ parted: fix EOF and ctrl-c handling. parted used to refuse to exit
+ in response to ctrl-c and would get stuck in an infinite loop
+ prompting for more input when it reached EOF on stdin.
+
libparted: Don't fail to manipulate partitions on dmraid disks that
have other partitions in use.
diff --git a/parted/ui.c b/parted/ui.c
index 22790bb..7df12e6 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -900,6 +900,10 @@ command_line_get_word (const char* prompt, const char* def,
command_line_prompt_words (prompt, def, possibilities,
multi_word);
+ if (got_ctrl_c) {
+ got_ctrl_c = 0;
+ return NULL;
+ }
} while (command_line_get_word_count ());
return NULL;
@@ -1581,7 +1585,7 @@ interactive_mode (PedDevice** dev, Command* cmd_list[])
Command* cmd;
while (!command_line_get_word_count ()) {
- if (feof (stdin)) {
+ if (got_ctrl_c) {
putchar ('\n');
return 1;
}
--
1.8.1.2
- [PATCH 1/9] parted: fix EOF and ctrl-c handling,
Phillip Susi <=
- [PATCH 2/9] tests: t6003-dm-hide: don't hang on exception, Phillip Susi, 2013/06/30
- [PATCH 3/9] gpt: Revert small device commits, Phillip Susi, 2013/06/30
- [PATCH 5/9] libparted: handle logical partitions starting immediately after the EBR, Phillip Susi, 2013/06/30
- [PATCH 4/9] libparted: set dmraid partition uuid, Phillip Susi, 2013/06/30
- [PATCH 9/9] Revert "linux-commit: do not unnecessarily open partition device nodes", Phillip Susi, 2013/06/30
- [PATCH 6/9] libparted: fix gpt end of disk handling, Phillip Susi, 2013/06/30
- [PATCH 7/9] parted: don't reload partition table on every command, Phillip Susi, 2013/06/30
- [PATCH 8/9] libparted: allow some common errors to be ignored, Phillip Susi, 2013/06/30