summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-worker.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-03-20 17:05:11 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-03-20 17:05:11 +0100
commit31bda5000136d77f516cf2080257835fb44deaef (patch)
treeb4c430aee7efcc71382ab73954612f6ff7fe3ef4 /apt-pkg/acquire-worker.cc
parent05343a22b8c7d9b491e93169e035a996ff68af9f (diff)
* apt-pkg/acquire-worker.cc:
- check return of write() as gcc recommends * apt-pkg/acquire.cc: - check return of write() as gcc recommends * apt-pkg/cdrom.cc: - check return of chdir() and link() as gcc recommends * apt-pkg/clean.cc: - check return of chdir() as gcc recommends * apt-pkg/contrib/netrc.cc: - check return of asprintf() as gcc recommends
Diffstat (limited to 'apt-pkg/acquire-worker.cc')
-rw-r--r--apt-pkg/acquire-worker.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc
index 3bb977e14..d79b2b16d 100644
--- a/apt-pkg/acquire-worker.cc
+++ b/apt-pkg/acquire-worker.cc
@@ -431,7 +431,23 @@ bool pkgAcquire::Worker::MediaChange(string Message)
<< Drive << ":" // drive
<< msg.str() // l10n message
<< endl;
- write(status_fd, status.str().c_str(), status.str().size());
+
+ std::string const dlstatus = status.str();
+ size_t done = 0;
+ size_t todo = dlstatus.size();
+ errno = 0;
+ int res = 0;
+ do
+ {
+ res = write(status_fd, dlstatus.c_str() + done, todo);
+ if (res < 0 && errno == EINTR)
+ continue;
+ if (res < 0)
+ break;
+ done += res;
+ todo -= res;
+ }
+ while (res > 0 && todo > 0);
}
if (Log == 0 || Log->MediaChange(LookupTag(Message,"Media"),