summaryrefslogtreecommitdiff
path: root/apt-pkg/cdrom.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/cdrom.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/cdrom.cc')
-rw-r--r--apt-pkg/cdrom.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 4462d4e24..50c204371 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -430,7 +430,8 @@ bool pkgCdrom::WriteDatabase(Configuration &Cnf)
Out.close();
- link(DFile.c_str(),string(DFile + '~').c_str());
+ if (FileExists(DFile) == true && link(DFile.c_str(),string(DFile + '~').c_str()) != 0)
+ return _error->Errno("link", "Failed to link %s to %s~", DFile.c_str(), DFile.c_str());
if (rename(NewFile.c_str(),DFile.c_str()) != 0)
return _error->Errno("rename","Failed to rename %s.new to %s",
DFile.c_str(),DFile.c_str());
@@ -697,7 +698,8 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/
return false;
}
- chdir(StartDir.c_str());
+ if (chdir(StartDir.c_str()) != 0)
+ return _error->Errno("chdir","Unable to change to %s", StartDir.c_str());
if (_config->FindB("Debug::aptcdrom",false) == true)
{