From bc32851dd434e58f97909cebe7f4f7d698c0c6e5 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 26 Oct 2005 18:33:47 +0000 Subject: [PATCH] fix strncmps --- lib/libdm-deptree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libdm-deptree.c b/lib/libdm-deptree.c index da1eeaf..c2e1301 100644 --- a/lib/libdm-deptree.c +++ b/lib/libdm-deptree.c @@ -377,7 +377,10 @@ static int _uuid_prefix_matches(const char *uuid, const char *uuid_prefix, size_ if (uuid_prefix_len <= 4) return 0; - if (!strcmp(uuid, "LVM-") || strcmp(uuid_prefix, "LVM-")) + if (!strncmp(uuid, "LVM-", 4)) + return 0; + + if (strncmp(uuid_prefix, "LVM-", 4)) return 0; if (!strncmp(uuid, uuid_prefix + 4, uuid_prefix_len - 4)) @@ -697,7 +700,7 @@ int dm_deptree_children_use_uuid(struct deptree_node *dnode, return 1; } - if (!strncmp(uuid, uuid_prefix, uuid_prefix_len)) + if (_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len)) return 1; if (dm_deptree_node_num_children(child, 0)) -- 2.43.5