summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire.cc5
-rw-r--r--apt-pkg/contrib/cdromutl.cc3
-rw-r--r--apt-pkg/contrib/mmap.cc5
-rw-r--r--apt-pkg/deb/dpkgpm.cc4
-rw-r--r--apt-pkg/depcache.cc4
-rw-r--r--apt-pkg/indexcopy.cc2
-rw-r--r--apt-pkg/versionmatch.cc2
7 files changed, 14 insertions, 11 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 6840ae120..38944bbac 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -444,8 +444,9 @@ bool pkgAcquire::Clean(string Dir)
unlink(Dir->d_name);
};
- chdir(StartDir.c_str());
closedir(D);
+ if (chdir(StartDir.c_str()) != 0)
+ return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
return true;
}
/*}}}*/
@@ -796,7 +797,7 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
// Compute the CPS
struct timeval NewTime;
gettimeofday(&NewTime,0);
- if (NewTime.tv_sec - Time.tv_sec == 6 && NewTime.tv_usec > Time.tv_usec ||
+ if ((NewTime.tv_sec - Time.tv_sec == 6 && NewTime.tv_usec > Time.tv_usec) ||
NewTime.tv_sec - Time.tv_sec > 6)
{
double Delta = NewTime.tv_sec - Time.tv_sec +
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index 6f00e1451..b6524a178 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -176,7 +176,8 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
Hash.Add(Dir->d_name);
};
- chdir(StartDir.c_str());
+ if (chdir(StartDir.c_str()) != 0)
+ return _error->Errno("chdir",_("Unable to change to %s"),StartDir.c_str());
closedir(D);
// Some stats from the fsys
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index abcae46fe..eed438250 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -192,7 +192,8 @@ DynamicMMap::~DynamicMMap()
unsigned long EndOfFile = iSize;
iSize = WorkSpace;
Close(false);
- ftruncate(Fd->Fd(),EndOfFile);
+ if(ftruncate(Fd->Fd(),EndOfFile) < 0)
+ _error->Errno("ftruncate", _("Failed to truncate file"));
}
/*}}}*/
// DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space /*{{{*/
@@ -209,7 +210,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
// Just in case error check
if (Result + Size > WorkSpace)
{
- _error->Error("Dynamic MMap ran out of room");
+ _error->Error(_("Dynamic MMap ran out of room"));
return 0;
}
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 4fad0fd52..85cf4e119 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -531,7 +531,7 @@ bool pkgDPkgPM::OpenLog()
struct tm *tmp = localtime(&t);
strftime(outstr, sizeof(outstr), "%F %T", tmp);
fprintf(term_out, "\nLog started: ");
- fprintf(term_out, outstr);
+ fprintf(term_out, "%s", outstr);
fprintf(term_out, "\n");
}
return true;
@@ -546,7 +546,7 @@ bool pkgDPkgPM::CloseLog()
struct tm *tmp = localtime(&t);
strftime(outstr, sizeof(outstr), "%F %T", tmp);
fprintf(term_out, "Log ended: ");
- fprintf(term_out, outstr);
+ fprintf(term_out, "%s", outstr);
fprintf(term_out, "\n");
fclose(term_out);
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index d8b4dc6d2..2411bfe89 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -269,7 +269,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
ostr.str(string(""));
ostr << "Package: " << pkg.Name()
<< "\nAuto-Installed: 1\n\n";
- fprintf(OutFile,ostr.str().c_str());
+ fprintf(OutFile,"%s",ostr.str().c_str());
fprintf(OutFile,"\n");
}
}
@@ -1001,7 +1001,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section()))
{
if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true)
- std::clog << "Setting NOT as auto-installed (direct dep of pkg in APT::Never-MarkAuto-Section)" << std::endl;
+ std::clog << "Setting NOT as auto-installed (direct dep of pkg in APT::Never-MarkAuto-Sections)" << std::endl;
MarkInstall(InstPkg,true,Depth + 1, true);
}
else
diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc
index b30777d8d..9e5c03e0b 100644
--- a/apt-pkg/indexcopy.cc
+++ b/apt-pkg/indexcopy.cc
@@ -639,7 +639,7 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
// Open the Release file and add it to the MetaIndex
if(!MetaIndex->Load(*I+"Release"))
{
- _error->Error(MetaIndex->ErrorText.c_str());
+ _error->Error("%s",MetaIndex->ErrorText.c_str());
return false;
}
diff --git a/apt-pkg/versionmatch.cc b/apt-pkg/versionmatch.cc
index 4a426809c..5c25c2f7b 100644
--- a/apt-pkg/versionmatch.cc
+++ b/apt-pkg/versionmatch.cc
@@ -124,7 +124,7 @@ bool pkgVersionMatch::MatchVer(const char *A,string B,bool Prefix)
const char *Ae = Ab + strlen(A);
// Strings are not a compatible size.
- if ((unsigned)(Ae - Ab) != B.length() && Prefix == false ||
+ if (((unsigned)(Ae - Ab) != B.length() && Prefix == false) ||
(unsigned)(Ae - Ab) < B.length())
return false;