[PATCH] fdisk: quit immediately with a single CTRL-D

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Francesco Cosoleto <cosoleto@xxxxxxxxx>
---
 fdisk/fdisk.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 5a69437..72bb361 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -1320,19 +1320,10 @@ got_dos_table:
 int
 read_line(void)
 {
-	static int got_eof = 0;
-
 	line_ptr = line_buffer;
-	if (!fgets(line_buffer, LINE_LENGTH, stdin)) {
-		if (feof(stdin))
-			got_eof++; 	/* user typed ^D ? */
-		if (got_eof >= 3) {
-			fflush(stdout);
-			fprintf(stderr, _("\ngot EOF thrice - exiting..\n"));
-			exit(1);
-		}
-		return 0;
-	}
+	if (!fgets(line_buffer, LINE_LENGTH, stdin))
+		exit(1);
+
 	while (*line_ptr && !isgraph(*line_ptr))
 		line_ptr++;
 	return *line_ptr;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux