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