summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-13 01:45:26 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-13 01:45:26 +0100
commitd328fd1a20543192a7ea3eac124f10a5793743e9 (patch)
tree68c68ff6bc12037ac74899f686fce9c0a3e419bd /apt-pkg
parenteef21b9f52adc2170a3a3ffd0258a19810cacfd7 (diff)
parent07f2526e45f9978201817237745727db6177c29a (diff)
merge with debian-sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cdrom.cc5
-rw-r--r--apt-pkg/contrib/cdromutl.cc51
-rw-r--r--apt-pkg/init.cc3
3 files changed, 34 insertions, 25 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 72d8e4d41..96d4e9c91 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -829,8 +829,6 @@ bool pkgCdrom::Add(pkgCdromStatus *log) /*{{{*/
}
}
-
-
// Unmount and finish
if (_config->FindB("APT::CDROM::NoMount",false) == false) {
log->Update(_("Unmounting CD-ROM...\n"), STEP_LAST);
@@ -921,6 +919,7 @@ pkgUdevCdromDevices::Scan() /*{{{*/
pkgUdevCdromDevices::~pkgUdevCdromDevices() /*{{{*/
{
- dlclose(libudev_handle);
+ if (libudev_handle != NULL)
+ dlclose(libudev_handle);
}
/*}}}*/
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index 0cf9697ac..6dce82fe1 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -64,35 +64,44 @@ bool UnmountCdrom(string Path)
{
if (IsMounted(Path) == false)
return true;
-
- int Child = ExecFork();
- // The child
- if (Child == 0)
+ for (int i=0;i<3;i++)
{
- // Make all the fds /dev/null
- for (int I = 0; I != 3; I++)
- dup2(open("/dev/null",O_RDWR),I);
+
+ int Child = ExecFork();
- if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true)
+ // The child
+ if (Child == 0)
{
- if (system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0)
+ // Make all the fds /dev/null
+ for (int I = 0; I != 3; I++)
+ dup2(open("/dev/null",O_RDWR),I);
+
+ if (_config->Exists("Acquire::cdrom::"+Path+"::UMount") == true)
+ {
+ if (system(_config->Find("Acquire::cdrom::"+Path+"::UMount").c_str()) != 0)
+ _exit(100);
+ _exit(0);
+ }
+ else
+ {
+ const char *Args[10];
+ Args[0] = "umount";
+ Args[1] = Path.c_str();
+ Args[2] = 0;
+ execvp(Args[0],(char **)Args);
_exit(100);
- _exit(0);
+ }
}
- else
- {
- const char *Args[10];
- Args[0] = "umount";
- Args[1] = Path.c_str();
- Args[2] = 0;
- execvp(Args[0],(char **)Args);
- _exit(100);
- }
+
+ // if it can not be umounted, give it a bit more time
+ // this can happen when auto-mount magic or fs/cdrom prober attack
+ if (ExecWait(Child,"umount",true) == true)
+ return true;
+ sleep(1);
}
- // Wait for mount
- return ExecWait(Child,"umount",true);
+ return false;
}
/*}}}*/
// MountCdrom - Mount a cdrom /*{{{*/
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index a54c09a36..d8c201b9d 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -65,11 +65,12 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Etc::vendorlist","vendors.list");
Cnf.Set("Dir::Etc::vendorparts","vendors.list.d");
Cnf.Set("Dir::Etc::main","apt.conf");
- Cnf.Set("Dir::ETc::netrc", "auth.conf");
+ Cnf.Set("Dir::Etc::netrc", "auth.conf");
Cnf.Set("Dir::Etc::parts","apt.conf.d");
Cnf.Set("Dir::Etc::preferences","preferences");
Cnf.Set("Dir::Etc::preferencesparts","preferences.d");
Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+ Cnf.Set("Dir::Media::MountPath","/media/apt");
// State
Cnf.Set("Dir::Log","var/log/apt");