From: Theodore Ts'o Date: Sat, 19 May 2007 01:44:29 +0000 (-0400) Subject: libblkid: Fix bug which could cuase bid_type to be corrupted X-Git-Tag: E2FSPROGS-1_40~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fb57a92d19696c123d02d89cfa1f1e6703dfc32;p=thirdparty%2Fe2fsprogs.git libblkid: Fix bug which could cuase bid_type to be corrupted Fortunately bid_type isn't used much, and bid_label and bid_uuid is only used by debugging code, so the impact of this bug was very minor. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index 303f7cf7f..e33320a08 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,9 @@ +2007-05-18 Theodore Tso + + * tag.c (blkid_set_tag): Fix bug where bid_type, bid_label, and + bid_uuid could get corrupted if their corresponding tag is + set to its original value using blkid_set_tag(). + 2007-05-17 Theodore Tso * cache.c (blkid_gc_cache): New function which removes any devices diff --git a/lib/blkid/tag.c b/lib/blkid/tag.c index c4e5c8219..57277cd80 100644 --- a/lib/blkid/tag.c +++ b/lib/blkid/tag.c @@ -139,14 +139,6 @@ int blkid_set_tag(blkid_dev dev, const char *name, if (!(val = blkid_strndup(value, vlength)) && value) return -BLKID_ERR_MEM; - /* Link common tags directly to the device struct */ - if (!strcmp(name, "TYPE")) - dev->bid_type = val; - else if (!strcmp(name, "LABEL")) - dev->bid_label = val; - else if (!strcmp(name, "UUID")) - dev->bid_uuid = val; - t = blkid_find_tag_dev(dev, name); if (!value) { if (t) @@ -189,6 +181,14 @@ int blkid_set_tag(blkid_dev dev, const char *name, } } + /* Link common tags directly to the device struct */ + if (!strcmp(name, "TYPE")) + dev->bid_type = val; + else if (!strcmp(name, "LABEL")) + dev->bid_label = val; + else if (!strcmp(name, "UUID")) + dev->bid_uuid = val; + if (dev->bid_cache) dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; return 0;