summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2021-04-23 15:01:07 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2021-04-23 15:04:32 +0200
commit94cf53979640ff8a29d445a2b056a6b17c7b3e49 (patch)
tree47ddd8a062527d1ca6211ca6e0c9a0bb9abe7d66
parent64376abd263aa3ea684c4d8debaec2b321306b47 (diff)
Avoid infinite loop on EOF on media change prompt
The code missed a break, so it was looping infinitely because the while loop condition only checked for '\n' and '\r', but not end of file.
-rw-r--r--apt-private/acqprogress.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc
index b37934cd4..fa7edfc82 100644
--- a/apt-private/acqprogress.cc
+++ b/apt-private/acqprogress.cc
@@ -322,8 +322,10 @@ bool AcqTextStatus::MediaChange(std::string Media, std::string Drive)
while (C != '\n' && C != '\r')
{
int len = read(STDIN_FILENO,&C,1);
- if(C == 'c' || len <= 0)
+ if(C == 'c' || len <= 0) {
bStatus = false;
+ break;
+ }
}
if(bStatus)