summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-07-28 09:25:57 +0200
committerMichael Vogt <mvo@debian.org>2013-07-28 09:25:57 +0200
commit0c33605d981ceb78a4761e39043dc79ef9a571b2 (patch)
tree83fa22dda53f0abccd7b9cf7376af8553c559068 /cmdline
parent402c0d19a0c6668d7710b2b48561eb3059a04584 (diff)
parent163dc55bd6891008adcdf6d683a94e890a00f8c7 (diff)
Merge remote-tracking branch 'mvo/bugfix/coverity' into debian/sid
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc10
-rw-r--r--cmdline/apt-mark.cc4
2 files changed, 8 insertions, 6 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 85ed80a95..73b396795 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -2290,9 +2290,10 @@ bool DoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(archivedir + "lock"));
- if (_error->PendingError() == true)
+ int lock_fd = GetLock(archivedir + "lock");
+ if (lock_fd < 0)
return _error->Error(_("Unable to lock the download directory"));
+ Lock.Fd(lock_fd);
}
pkgAcquire Fetcher;
@@ -2326,9 +2327,10 @@ bool DoAutoClean(CommandLine &CmdL)
FileFd Lock;
if (_config->FindB("Debug::NoLocking",false) == false)
{
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
- if (_error->PendingError() == true)
+ int lock_fd = GetLock(_config->FindDir("Dir::Cache::Archives") + "lock");
+ if (lock_fd < 0)
return _error->Error(_("Unable to lock the download directory"));
+ Lock.Fd(lock_fd);
}
CacheFile Cache;
diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc
index c5b7ca496..4c0fc2893 100644
--- a/cmdline/apt-mark.cc
+++ b/cmdline/apt-mark.cc
@@ -202,13 +202,13 @@ bool DoHold(CommandLine &CmdL)
if (dpkgAssertMultiArch == 0)
{
std::string const chrootDir = _config->FindDir("DPkg::Chroot-Directory");
- if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
- _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --assert-multi-arch", chrootDir.c_str());
// redirect everything to the ultimate sink as we only need the exit-status
int const nullfd = open("/dev/null", O_RDONLY);
dup2(nullfd, STDIN_FILENO);
dup2(nullfd, STDOUT_FILENO);
dup2(nullfd, STDERR_FILENO);
+ if (chrootDir != "/" && chroot(chrootDir.c_str()) != 0)
+ _error->WarningE("getArchitecture", "Couldn't chroot into %s for dpkg --assert-multi-arch", chrootDir.c_str());
execvp(Args[0], (char**) &Args[0]);
_error->WarningE("dpkgGo", "Can't detect if dpkg supports multi-arch!");
_exit(2);