mschorm / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
0c223bc
0c223bc
 The UUID code in the mount command is broken -- en example UUID= in the fstab
0c223bc
 file is reason for SIGSEG when non-root user tries umount any device.
0c223bc
 -- 03/30/2006 Karel Zak <kzak@redhat.com> 
0c223bc
0c223bc
--- util-linux-2.13-pre6/mount/mount_blkid.h.uuid	2006-03-29 15:34:24.000000000 +0200
0c223bc
+++ util-linux-2.13-pre6/mount/mount_blkid.h	2006-03-29 15:34:57.000000000 +0200
0c223bc
@@ -8,5 +8,6 @@
0c223bc
 extern const char *mount_get_devname_by_uuid(const char *uuid);
0c223bc
 extern const char *mount_get_devname_by_label(const char *label);
0c223bc
 extern const char *mount_get_volume_label_by_spec(const char *spec);
0c223bc
+extern const char *mount_get_volume_uuid_by_spec(const char *spec);
0c223bc
 extern const char *mount_get_devname(const char *spec);
0c223bc
 extern const char *mount_get_devname_for_mounting(const char *spec);
0c223bc
--- util-linux-2.13-pre6/mount/mount_blkid.c.uuid	2006-03-29 15:33:44.000000000 +0200
0c223bc
+++ util-linux-2.13-pre6/mount/mount_blkid.c	2006-03-29 15:34:14.000000000 +0200
0c223bc
@@ -21,6 +21,11 @@
0c223bc
 }
0c223bc
 
0c223bc
 const char *
0c223bc
+mount_get_volume_uuid_by_spec(const char *spec) {
0c223bc
+	return blkid_get_tag_value(blkid, "UUID", spec);
0c223bc
+}
0c223bc
+
0c223bc
+const char *
0c223bc
 mount_get_devname(const char *spec) {
0c223bc
 	return blkid_get_devname(blkid, spec, 0);
0c223bc
 }
0c223bc
--- util-linux-2.13-pre6/mount/fstab.c.uuid	2006-03-29 15:29:28.000000000 +0200
0c223bc
+++ util-linux-2.13-pre6/mount/fstab.c	2006-03-29 15:36:30.000000000 +0200
0c223bc
@@ -301,23 +301,19 @@
0c223bc
 static int
0c223bc
 has_label(const char *device, const char *label) {
0c223bc
 	const char *devlabel;
0c223bc
-	int ret;
0c223bc
 
0c223bc
-	devlabel = mount_get_volume_label_by_spec(device);
0c223bc
-	ret = !strcmp(label, devlabel);
0c223bc
-	/* free(devlabel); */
0c223bc
-	return ret;
0c223bc
+	if (!(devlabel = mount_get_volume_label_by_spec(device)))
0c223bc
+		return 0;
0c223bc
+	return !strcmp(label, devlabel);
0c223bc
 }
0c223bc
 
0c223bc
 static int
0c223bc
 has_uuid(const char *device, const char *uuid){
0c223bc
 	const char *devuuid;
0c223bc
-	int ret;
0c223bc
 
0c223bc
-	devuuid = mount_get_devname_by_uuid(device);
0c223bc
-	ret = !strcmp(uuid, devuuid);
0c223bc
-	/* free(devuuid); */
0c223bc
-	return ret;
0c223bc
+	if (!(devuuid = mount_get_volume_uuid_by_spec(device)))
0c223bc
+		return 0;
0c223bc
+	return !strcmp(uuid, devuuid);
0c223bc
 }
0c223bc
 
0c223bc
 /* Find the entry (SPEC,FILE) in fstab */