summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-01-22 20:06:37 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-01-22 20:06:37 +0100
commit0d2e73c7aadad2b84ef19f2a37914c829a465573 (patch)
treefe8e818914b6ef889eb848d945838e08747ab710
parent4d3a448b693e15b181bb75d725b5e74cc330b4df (diff)
downloadapt-0d2e73c7aadad2b84ef19f2a37914c829a465573.tar.gz
* apt-pkg/contrib/cdromutl.cc:
- fix UnmountCdrom() fails, give it a bit more time and try the umount again
-rw-r--r--apt-pkg/contrib/cdromutl.cc51
-rw-r--r--debian/changelog8
2 files changed, 38 insertions, 21 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index 0cf9697a..6dce82fe 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/debian/changelog b/debian/changelog
index e8cf08be..59882603 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+apt (0.7.25.2) UNRELEASED; urgency=low
+
+ * apt-pkg/contrib/cdromutl.cc:
+ - fix UnmountCdrom() fails, give it a bit more time and try
+ the umount again
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 22 Jan 2010 20:06:12 +0100
+
apt (0.7.25.1) unstable; urgency=low
[ Christian Perrier ]