Parcourir la source

check fgetc() for EOF return so we don't spin if we can't read input

Wichert Akkerman il y a 24 ans
Parent
commit
3c7ebb33f7
3 fichiers modifiés avec 9 ajouts et 3 suppressions
  1. 5 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 3 3
      dselect/method.cc

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Wed Feb  6 12:29:18 CET 2002 Wichert Akkerman <wakkerma@debian.org>
+
+  * dselect/method.cc: check fgetc() for EOF return so we don't spin
+    if we can't read input
+
 Sun Feb  3 22:21:08 CET 2002 Wichert Akkerman <wakkerma@debian.org>
 
   * po/fr.po: Updated

+ 1 - 0
debian/changelog

@@ -78,6 +78,7 @@ dpkg (1.10) unstable; urgency=low
     a non-existing alternative. Closes: Bug#131496
   * Use gzip -c in install-info. Closes: Bug#131758
   * start-stop-daemon works on HP-UX now. Closes: Bug#130130
+  * Fix dselect spin when run without input. Closes: Bug#132476
 
  -- Wichert Akkerman <wakkerma@debian.org>  Mon, 20 Aug 2001 14:54:38 +0200
 

+ 3 - 3
dselect/method.cc

@@ -3,7 +3,7 @@
  * method.cc - access method handling
  *
  * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
- * Copyright (C) 2001 Wichert Akkerman <wakkerma@debian.org>
+ * Copyright (C) 2001,2002 Wichert Akkerman <wakkerma@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -197,8 +197,8 @@ urqresult falliblesubprocess(const char *exepath, const char *name,
   fprintf(stderr,_("Press <enter> to continue.\n"));
   if (ferror(stderr))
     ohshite(_("write error on standard error"));
-  do { c= fgetc(stdin); } while ((c == ERR && errno==EINTR) || (c != '\n'));
-  if (c == ERR)
+  do { c= fgetc(stdin); } while ((c == ERR && errno==EINTR) || ((c != '\n') && c != EOF));
+  if ((c == ERR) || (c == EOF))
     ohshite(_("error reading acknowledgement of program failure message"));
   return urqr_fail;
 }