[lxc-devel] [lxc/master] ls: simplify the judgment condition when list active containers

0x0916 on Github lxc-bot at linuxcontainers.org
Sun Apr 16 02:42:42 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 601 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170416/f8784651/attachment.bin>
-------------- next part --------------
From aae7aac8fe40d187e715ed4e021c731204086d17 Mon Sep 17 00:00:00 2001
From: 0x0916 <w at laoqinren.net>
Date: Sun, 16 Apr 2017 10:34:08 +0800
Subject: [PATCH] ls: simplify the judgment condition when list active
 containers

`(args->ls_active && args->ls_frozen)` always false if `args->ls_active` is false.
so we can delete the second  judgment condition and only keep the first one.

Signed-off-by: 0x0916 <w at laoqinren.net>
---
 src/lxc/tools/lxc_ls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/tools/lxc_ls.c b/src/lxc/tools/lxc_ls.c
index 363d3d2..6415e7c 100644
--- a/src/lxc/tools/lxc_ls.c
+++ b/src/lxc/tools/lxc_ls.c
@@ -356,7 +356,7 @@ static int ls_get(struct ls **m, size_t *size, const struct lxc_arguments *args,
 	}
 
 	/* Do not do more work than is necessary right from the start. */
-	if (args->ls_active || (args->ls_active && args->ls_frozen))
+	if (args->ls_active)
 		num = list_active_containers(path, &containers, NULL);
 	else
 		num = list_all_containers(path, &containers, NULL);


More information about the lxc-devel mailing list