From 94cf53979640ff8a29d445a2b056a6b17c7b3e49 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 23 Apr 2021 15:01:07 +0200 Subject: 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. --- apt-private/acqprogress.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3-70-g09d2