apt/apt-0.5.15cnc6-alt-umount.patch
Dmitry V. Levin 8b55ef8c63 0.5.15cnc6-alt11
- apt-get: corrected virtual package remove algorithm (#6276).
- Updated default cdrom mount point (#6152).
2005-05-18 17:03:04 +00:00

34 lines
987 B
Diff

--- apt-0.5.15cnc6/apt-pkg/contrib/cdromutl.cc~ 2005-05-14 13:13:03 +0400
+++ apt-0.5.15cnc6/apt-pkg/contrib/cdromutl.cc 2005-05-14 13:26:05 +0400
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
+#include <mntent.h>
/*}}}*/
// IsMounted - Returns true if the mount point is mounted /*{{{*/
@@ -100,6 +101,22 @@ bool UnmountCdrom(string Path)
}
else
{
+ FILE *f;
+ if ((f = setmntent ("/proc/mounts", "r")) != NULL)
+ {
+ struct mntent *mnt;
+ while ((mnt = getmntent (f)) != NULL)
+ {
+ string MntDir(mnt->mnt_dir);
+ if (MntDir[MntDir.length() - 1] != '/')
+ MntDir += '/';
+ if ( Path == MntDir )
+ if ((strcmp ("subfs", mnt->mnt_type) == 0) || (strcmp ("supermount", mnt->mnt_type) == 0))
+ _exit(0);
+ }
+ endmntent (f);
+ }
+
const char *Args[10];
Args[0] = "umount";
Args[1] = Path.c_str();