+// DpkgLock::CheckUpdates - Check if the updates dir is dirty /*{{{*/
+// ---------------------------------------------------------------------
+/* This does a check of the updates directory to see if it has any entries
+ in it. */
+bool pkgDpkgLock::CheckUpdates()
+{
+ // Check for updates.. (dirty)
+ string File = flNotFile(_config->Find("Dir::State::status")) + "updates/";
+ DIR *DirP = opendir(File.c_str());
+ if (DirP == 0)
+ return true;
+
+ /* We ignore any files that are not all digits, this skips .,.. and
+ some tmp files dpkg will leave behind.. */
+ bool Damaged = false;
+ for (struct dirent *Ent = readdir(DirP); Ent != 0; Ent = readdir(DirP))
+ {
+ Damaged = true;
+ for (unsigned int I = 0; Ent->d_name[I] != 0; I++)
+ {
+ // Check if its not a digit..
+ if (isdigit(Ent->d_name[I]) == 0)
+ {
+ Damaged = false;
+ break;
+ }
+ }
+ if (Damaged == true)
+ break;
+ }
+ closedir(DirP);
+
+ return Damaged;
+}
+ /*}}}*/
+