Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > a7c16eeaa50b94b34d5dec6e3ef75d26 > files > 6

gnome-vfs2-2.24.4-4.mga3.src.rpm

--- 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 <errno.h>
 #include <string.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <libgnomevfs/gnome-vfs.h>
 
 #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