mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
mount-points: fix matching of paths where there's also an entry with a common prefix
e.g. with the following mount points /raw /raw/snapshot /raw/video _match() would not match /raw/video and /raw/snapshot correctly. https://bugzilla.gnome.org/show_bug.cgi?id=771555
This commit is contained in:
parent
b1f515178a
commit
c3e58dfdbe
1 changed files with 9 additions and 8 deletions
|
@ -248,6 +248,8 @@ gst_rtsp_mount_points_match (GstRTSPMountPoints * mounts,
|
|||
item.path = (gchar *) path;
|
||||
item.len = strlen (path);
|
||||
|
||||
GST_LOG ("Looking for mount point path %s", path);
|
||||
|
||||
g_mutex_lock (&priv->lock);
|
||||
if (priv->dirty) {
|
||||
g_sequence_sort (priv->mounts, data_item_compare, mounts);
|
||||
|
@ -266,18 +268,17 @@ gst_rtsp_mount_points_match (GstRTSPMountPoints * mounts,
|
|||
|
||||
data_item_dump (ritem, "inspect: ");
|
||||
|
||||
if (best == NULL) {
|
||||
if (has_prefix (&item, ritem)) {
|
||||
/* The sequence is sorted, so any prefix match is an improvement upon
|
||||
* the previous best match, as '/abc' will always be before '/abcd' */
|
||||
if (has_prefix (&item, ritem)) {
|
||||
if (best == NULL) {
|
||||
data_item_dump (ritem, "prefix: ");
|
||||
best = iter;
|
||||
} else {
|
||||
data_item_dump (ritem, "new best: ");
|
||||
}
|
||||
} else {
|
||||
if (!has_prefix (&item, ritem))
|
||||
break;
|
||||
|
||||
best = iter;
|
||||
data_item_dump (ritem, "new best: ");
|
||||
}
|
||||
|
||||
iter = g_sequence_iter_next (iter);
|
||||
}
|
||||
if (best) {
|
||||
|
|
Loading…
Reference in a new issue