--- gnome-vfs-2.18.0.1/libgnomevfs/gnome-vfs-unix-mounts.c.uuid-label-mount 2007-10-01 19:23:51.000000000 +0200 +++ gnome-vfs-2.18.0.1/libgnomevfs/gnome-vfs-unix-mounts.c 2007-10-01 19:30:48.000000000 +0200 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include "gnome-vfs-unix-mounts.h" @@ -290,6 +291,15 @@ _gnome_vfs_get_current_unix_mounts (GLis mount_entry->mount_path = g_strdup (mntent->mnt_dir); mount_entry->device_path = g_strdup (mntent->mnt_fsname); + + if (g_file_test (mntent->mnt_fsname, G_FILE_TEST_IS_SYMLINK)) { + char rpath[PATH_MAX]; + if (realpath (mntent->mnt_fsname, rpath)) { + g_free (mount_entry->device_path); + mount_entry->device_path = g_strdup (rpath); + } + } + mount_entry->filesystem_type = g_strdup (mntent->mnt_type); g_hash_table_insert (mounts_hash, @@ -541,6 +551,7 @@ _gnome_vfs_get_unix_mount_table (GList * char *opt, *opt_end; struct stat sb; GnomeVFSUnixMountPoint *mount_entry; + gboolean is_label, is_uuid; stat_file = read_file = get_fstab_file (); @@ -574,6 +585,41 @@ _gnome_vfs_get_unix_mount_table (GList * mount_entry->mount_path = g_strdup (mntent->mnt_dir); mount_entry->device_path = g_strdup (mntent->mnt_fsname); + + is_label = is_uuid = FALSE; + + if ((is_uuid = g_str_has_prefix (mount_entry->device_path, "UUID=")) || (is_label = g_str_has_prefix (mount_entry->device_path, "LABEL=")) || g_str_has_prefix(mount_entry->device_path,"/dev/disk/by-")) { + gchar *device_path; + + if (is_uuid) { + device_path = g_strdup_printf ("/dev/disk/by-uuid/%s", mount_entry->device_path+5); + } else { + if (is_label) { + device_path = g_strdup_printf ("/dev/disk/by-label/%s", mount_entry->device_path+6); + } + else { + device_path = g_strdup (mount_entry->device_path); + } + } + + if (g_file_test (device_path, G_FILE_TEST_IS_SYMLINK)) { + char rpath[PATH_MAX]; + if (realpath (device_path, rpath)) { + g_free (mount_entry->device_path); + mount_entry->device_path = g_strdup (rpath); + } + else { + g_free (device_path); + continue; + } + } + else { + g_free (device_path); + continue; + } + g_free (device_path); + } + mount_entry->filesystem_type = g_strdup (mntent->mnt_type); #ifdef HAVE_HASMNTOPT