diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-23 15:01:07 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-23 15:04:32 +0200 |
commit | 94cf53979640ff8a29d445a2b056a6b17c7b3e49 (patch) | |
tree | 47ddd8a062527d1ca6211ca6e0c9a0bb9abe7d66 | |
parent | 64376abd263aa3ea684c4d8debaec2b321306b47 (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.cc | 4 |
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) |