[lxc-devel] [lxc/master] try to fix search user instead of search substring

avkvl on Github lxc-bot at linuxcontainers.org
Fri Aug 2 15:39:40 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 437 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190802/3bbd2a0e/attachment.bin>
-------------- next part --------------
From 9ed8c96ffbcc3028cbb44d3e620502c978c27f62 Mon Sep 17 00:00:00 2001
From: Alexander Kriventsov <akriventsov at nic.ru>
Date: Mon, 29 Jul 2019 19:33:39 +0300
Subject: [PATCH] try to fix search user instead of search substring

Signed-off-by: Alexander Kriventsov <akriventsov at nic.ru>
---
 src/lxc/cmd/lxc_user_nic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/cmd/lxc_user_nic.c b/src/lxc/cmd/lxc_user_nic.c
index 84823bd5d8..15d000eebf 100644
--- a/src/lxc/cmd/lxc_user_nic.c
+++ b/src/lxc/cmd/lxc_user_nic.c
@@ -423,7 +423,8 @@ static char *find_line(char *buf_start, char *buf_end, char *name,
 		if (strncmp(buf_start, name, strlen(name)))
 			*found = false;
 		else
-			*owner = true;
+			if (strlen(name) == (size_t)(end_of_word - buf_start))
+				*owner = true;
 
 		buf_start = end_of_word + 1;
 		while ((buf_start < buf_end) && isblank(*buf_start))


More information about the lxc-devel mailing list