Ver código fonte

Flush the terminal's input before prompting the user.

Nicolas FRANCOIS 20 anos atrás
pai
commit
3ab8573468
3 arquivos alterados com 12 adições e 0 exclusões
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 5 0
      src/configure.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2006-05-15  Nicolas François  <nicolas.francois@centraliens.net>
+
+	* src/configure.c: Flush the terminal's input before
+	prompting the user.
+
 2006-05-15  Frank Lichtenheld  <djpig@debian.org>
 
 	* debian/archtable: Update to reflect current

+ 2 - 0
debian/changelog

@@ -38,6 +38,8 @@ dpkg (1.13.20~) UNRELEASED; urgency=low
     Closes: #366587
   * Honour tabbing requested via --show-format even if the field to
     be printed is empty. Closes: #361671
+  * flush the terminal's input before prompting what to do with a
+    configuration file. Closes: #316551
 
   [ Updated dpkg Translations ]
   * Portuguese (Miguel Figueiredo).

+ 5 - 0
src/configure.c

@@ -37,6 +37,7 @@
 #include <assert.h>
 #include <sys/wait.h>
 #include <time.h>
+#include <sys/termios.h>
 
 #include <dpkg.h>
 #include <dpkg-db.h>
@@ -553,6 +554,10 @@ static enum conffopt promptconfaction(const char* cfgfile, const char* realold,
 	}
 
 	do {
+		/* Flush the terminal's input in case the user
+		 * involuntarily typed some characters.
+		 */
+		tcflush(STDIN_FILENO, TCIFLUSH);
 		fprintf(stderr, _("\nConfiguration file `%s'"), cfgfile);
 		if (strcmp(cfgfile, realold))
 			fprintf(stderr,_(" (actually `%s')"), realold);