Merge branch 'wip/oholy/trash-autofs' into 'master'

gunixmounts: Return the last matching mount for same mount path

Closes #1727

See merge request GNOME/glib!740
This commit is contained in:
Philip Withnall 2019-04-03 12:23:10 +00:00
commit abde3efb34

View File

@ -1552,6 +1552,9 @@ g_unix_mounts_get (guint64 *time_read)
* is set, it will be filled with a unix timestamp for checking
* if the mounts have changed since with g_unix_mounts_changed_since().
*
* If more mounts have the same mount path, the last matching mount
* is returned.
*
* Returns: (transfer full): a #GUnixMountEntry.
**/
GUnixMountEntry *
@ -1568,8 +1571,13 @@ g_unix_mount_at (const char *mount_path,
{
mount_entry = l->data;
if (!found && strcmp (mount_path, mount_entry->mount_path) == 0)
found = mount_entry;
if (strcmp (mount_path, mount_entry->mount_path) == 0)
{
if (found != NULL)
g_unix_mount_free (found);
found = mount_entry;
}
else
g_unix_mount_free (mount_entry);
}
@ -1587,6 +1595,9 @@ g_unix_mount_at (const char *mount_path,
* is set, it will be filled with a unix timestamp for checking
* if the mounts have changed since with g_unix_mounts_changed_since().
*
* If more mounts have the same mount path, the last matching mount
* is returned.
*
* Returns: (transfer full): a #GUnixMountEntry.
*
* Since: 2.52