summaryrefslogtreecommitdiffstats
path: root/misc-utils/uuidparse.c
diff options
context:
space:
mode:
authorSami Kerola2017-07-29 23:14:34 +0200
committerSami Kerola2017-08-05 10:58:25 +0200
commit8cfbd350482cffbfbfbf1edee26226fe00bbc7d7 (patch)
tree4a0a601c4375beda593094dfc714e0fa9c5a1e6b /misc-utils/uuidparse.c
parentvipw: use explicit_bzero() to clear buffer after copy (diff)
downloadkernel-qcow2-util-linux-8cfbd350482cffbfbfbf1edee26226fe00bbc7d7.tar.gz
kernel-qcow2-util-linux-8cfbd350482cffbfbfbf1edee26226fe00bbc7d7.tar.xz
kernel-qcow2-util-linux-8cfbd350482cffbfbfbf1edee26226fe00bbc7d7.zip
uuidparse: nil uuid have all bits set to zero
The nil UUID is special form of UUID that is specified to have all 128 bits set to zero. Reference: https://tools.ietf.org/html/rfc4122#section-4.1.7 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/uuidparse.c')
-rw-r--r--misc-utils/uuidparse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/misc-utils/uuidparse.c b/misc-utils/uuidparse.c
index 49225ae2c..5fa34b23d 100644
--- a/misc-utils/uuidparse.c
+++ b/misc-utils/uuidparse.c
@@ -195,7 +195,10 @@ static void fill_table_row(struct libscols_table *tb, char const *const uuid)
}
switch (type) {
case 0:
- str = xstrdup(_("nil"));
+ if (strspn(uuid, "0-") == 36)
+ str = xstrdup(_("nil"));
+ else
+ str = xstrdup(_("unknown"));
break;
case 1:
str = xstrdup(_("time-based"));