summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-22 18:32:08 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-22 18:32:08 +0200
commit49cb36fc56225b02b4c39aea43095de15da75217 (patch)
tree80da1358b64e770e37ce5274bd7cca7c3e9a29f8 /apt-pkg
parenta6418a4b93376e0e4acf36e88eb1d0ec41e024df (diff)
methods/cdrom.cc: move the scan into the loop that waits for a CD
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cdrom.cc7
-rw-r--r--apt-pkg/cdrom.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 517efa180..157f0ea3c 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -847,7 +847,7 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
pkgUdevCdromDevices::pkgUdevCdromDevices()
- : libudev_handle(NULL)
+ : libudev_handle(NULL), Dlopened(false)
{
}
@@ -855,6 +855,10 @@ pkgUdevCdromDevices::pkgUdevCdromDevices()
bool
pkgUdevCdromDevices::Dlopen()
{
+ // alread open
+ if(Dlopened)
+ return true;
+
// see if we can get libudev
void *h = ::dlopen("libudev.so.0", RTLD_LAZY);
if(h == NULL)
@@ -874,6 +878,7 @@ pkgUdevCdromDevices::Dlopen()
udev_list_entry_get_next = (udev_list_entry* (*)(udev_list_entry*))dlsym(h, "udev_list_entry_get_next");
udev_device_get_property_value = (const char* (*)(udev_device *, const char *))dlsym(h, "udev_device_get_property_value");
+ Dlopened = true;
return true;
}
diff --git a/apt-pkg/cdrom.h b/apt-pkg/cdrom.h
index 13e7203f4..74667297e 100644
--- a/apt-pkg/cdrom.h
+++ b/apt-pkg/cdrom.h
@@ -77,6 +77,8 @@ struct CdromDevice
class pkgUdevCdromDevices
{
+ private:
+ bool Dlopened;
protected:
// libudev dlopen stucture
void *libudev_handle;