summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-03-09 12:16:12 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-03-09 12:16:12 +0100
commit4703608e2ab7549e542410465304078b1ccfa793 (patch)
tree89ad934ae660a7a9f13b0c3515ca9c3d66ac9c7c /apt-pkg
parent06aca6c3facc4e48d0170fb766b47d919b5258e0 (diff)
cherry pick (2) from lp:~mvo/apt/mvo
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cdrom.cc11
-rw-r--r--apt-pkg/contrib/cdromutl.cc6
-rw-r--r--apt-pkg/contrib/cdromutl.h2
3 files changed, 12 insertions, 7 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 86fe45fbe..1e084bfb5 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -895,8 +895,13 @@ pkgUdevCdromDevices::Scan() /*{{{*/
if (udevice == NULL)
continue;
const char* devnode = udev_device_get_devnode(udevice);
- const char* mountpath = udev_device_get_property_value(udevice, "FSTAB_DIR");
- if (mountpath == NULL)
+
+ // try fstab_dir first
+ string mountpath;
+ const char* mp = udev_device_get_property_value(udevice, "FSTAB_DIR");
+ if (mp)
+ mountpath = string(mp);
+ else
mountpath = FindMountPointForDevice(devnode);
if (_config->FindB("Debug::Acquire::cdrom", false))
@@ -904,7 +909,7 @@ pkgUdevCdromDevices::Scan() /*{{{*/
// fill in the struct
cdrom.DeviceName = string(devnode);
- if (mountpath) {
+ if (mountpath != "") {
cdrom.MountPath = mountpath;
string s = string(mountpath);
cdrom.Mounted = IsMounted(s);
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index cf1c0c29b..83c324f54 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -237,7 +237,7 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version)
/*}}}*/
// FindMountPointForDevice - Find mountpoint for the given device /*{{{*/
-char* FindMountPointForDevice(const char *devnode)
+string FindMountPointForDevice(const char *devnode)
{
char buf[255];
char *out[10];
@@ -254,14 +254,14 @@ char* FindMountPointForDevice(const char *devnode)
while ( fgets(buf, sizeof(buf), f) != NULL) {
if (strncmp(buf, devnode, strlen(devnode)) == 0) {
if(TokSplitString(' ', buf, out, 10))
- return strdup(out[1]);
+ return string(out[1]);
}
}
fclose(f);
}
}
- return NULL;
+ return string();
}
diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h
index 4f0f90347..38ed2996e 100644
--- a/apt-pkg/contrib/cdromutl.h
+++ b/apt-pkg/contrib/cdromutl.h
@@ -19,6 +19,6 @@ bool MountCdrom(string Path, string DeviceName="");
bool UnmountCdrom(string Path);
bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
bool IsMounted(string &Path);
-char *FindMountPointForDevice(const char *device);
+string FindMountPointForDevice(const char *device);
#endif