apt/apt-0.5.15cnc6-alt-umount.patch
Dmitry V. Levin f064429f6c 0.5.15cnc6-alt6
- /var/lib/apt: relocated to libapt subpackage (#4697).
- UnmountCdrom(): silently ignore subfs and supermount filesystems (#4806).
2004-08-31 15:38:11 +00:00

29 lines
891 B
Diff

--- apt-0.5.15cnc6/apt-pkg/contrib/cdromutl.cc~ 2004-07-20 15:12:54 +0400
+++ apt-0.5.15cnc6/apt-pkg/contrib/cdromutl.cc 2004-07-20 15:23:42 +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 +102,17 @@ bool UnmountCdrom(string Path)
}
else
{
+ FILE *f;
+ if ((f = setmntent (MOUNTED, "r")) != NULL)
+ {
+ struct mntent *mnt;
+ while ((mnt = getmntent (f)) != NULL)
+ if (strcmp (Path.c_str(), mnt->mnt_fsname) == 0)
+ 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();