]>
Commit | Line | Data |
---|---|---|
5545a732 JR |
1 | |
2 | The UUID code in the mount command is broken -- en example UUID= in the fstab | |
3 | file is reason for SIGSEG when non-root user tries umount any device. | |
4 | -- 03/30/2006 Karel Zak <kzak@redhat.com> | |
5 | ||
6 | --- util-linux-2.13-pre6/mount/mount_blkid.h.uuid 2006-03-29 15:34:24.000000000 +0200 | |
7 | +++ util-linux-2.13-pre6/mount/mount_blkid.h 2006-03-29 15:34:57.000000000 +0200 | |
8 | @@ -8,5 +8,6 @@ | |
9 | extern const char *mount_get_devname_by_uuid(const char *uuid); | |
10 | extern const char *mount_get_devname_by_label(const char *label); | |
11 | extern const char *mount_get_volume_label_by_spec(const char *spec); | |
12 | +extern const char *mount_get_volume_uuid_by_spec(const char *spec); | |
13 | extern const char *mount_get_devname(const char *spec); | |
14 | extern const char *mount_get_devname_for_mounting(const char *spec); | |
15 | --- util-linux-2.13-pre6/mount/mount_blkid.c.uuid 2006-03-29 15:33:44.000000000 +0200 | |
16 | +++ util-linux-2.13-pre6/mount/mount_blkid.c 2006-03-29 15:34:14.000000000 +0200 | |
17 | @@ -21,6 +21,11 @@ | |
18 | } | |
19 | ||
20 | const char * | |
21 | +mount_get_volume_uuid_by_spec(const char *spec) { | |
22 | + return blkid_get_tag_value(blkid, "UUID", spec); | |
23 | +} | |
24 | + | |
25 | +const char * | |
26 | mount_get_devname(const char *spec) { | |
27 | return blkid_get_devname(blkid, spec, 0); | |
28 | } | |
29 | --- util-linux-2.13-pre6/mount/fstab.c.uuid 2006-03-29 15:29:28.000000000 +0200 | |
30 | +++ util-linux-2.13-pre6/mount/fstab.c 2006-03-29 15:36:30.000000000 +0200 | |
31 | @@ -301,23 +301,19 @@ | |
32 | static int | |
33 | has_label(const char *device, const char *label) { | |
34 | const char *devlabel; | |
35 | - int ret; | |
36 | ||
37 | - devlabel = mount_get_volume_label_by_spec(device); | |
38 | - ret = !strcmp(label, devlabel); | |
39 | - /* free(devlabel); */ | |
40 | - return ret; | |
41 | + if (!(devlabel = mount_get_volume_label_by_spec(device))) | |
42 | + return 0; | |
43 | + return !strcmp(label, devlabel); | |
44 | } | |
45 | ||
46 | static int | |
47 | has_uuid(const char *device, const char *uuid){ | |
48 | const char *devuuid; | |
49 | - int ret; | |
50 | ||
51 | - devuuid = mount_get_devname_by_uuid(device); | |
52 | - ret = !strcmp(uuid, devuuid); | |
53 | - /* free(devuuid); */ | |
54 | - return ret; | |
55 | + if (!(devuuid = mount_get_volume_uuid_by_spec(device))) | |
56 | + return 0; | |
57 | + return !strcmp(uuid, devuuid); | |
58 | } | |
59 | ||
60 | /* Find the entry (SPEC,FILE) in fstab */ |