From: Karel Zak Date: Wed, 21 Jan 2009 16:01:22 +0000 (+0100) Subject: blkid: fix udev output X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d46c8ab3e0e383bedb922a1c15d9aa5a49371026;p=util-linux blkid: fix udev output - uses the "safe" output for non-encoded values - makes the print_udev_format() more readable Signed-off-by: Karel Zak --- diff --git a/libs/blkid/bin/blkid.c b/libs/blkid/bin/blkid.c index a903f4e6..e65fdaff 100644 --- a/libs/blkid/bin/blkid.c +++ b/libs/blkid/bin/blkid.c @@ -234,26 +234,25 @@ static void pretty_print_dev(blkid_dev dev) static void print_udev_format(const char *name, const char *value, size_t sz) { char enc[265], safe[256]; - int has_enc_name = 0; *safe = *enc = '\0'; - if (!strcmp(name, "TYPE") || !strcmp(name, "VERSION")) + if (!strcmp(name, "TYPE") || !strcmp(name, "VERSION")) { blkid_encode_string(value, enc, sizeof(enc)); + printf("ID_FS_%s=%s\n", name, enc); - else if (!strcmp(name, "UUID") || + } else if (!strcmp(name, "UUID") || !strcmp(name, "LABEL") || !strcmp(name, "UUID_SUB")) { blkid_safe_string(value, safe, sizeof(safe)); - blkid_encode_string(value, enc, sizeof(enc)); - has_enc_name = 1; - } - - printf("ID_FS_%s=%s\n", name, *enc ? enc : *safe ? safe : value); + printf("ID_FS_%s=%s\n", name, safe); - if (*enc && has_enc_name) + blkid_encode_string(value, enc, sizeof(enc)); printf("ID_FS_%s_ENC=%s\n", name, enc); + } + else + printf("ID_FS_%s=%s\n", name, value); } static void print_value(int output, int num, blkid_dev dev,