[lxc-devel] [PATCH] lxc_info: Fix -H with -c

Stéphane Graber stgraber at ubuntu.com
Fri Jan 31 09:18:44 UTC 2014


Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 src/lxc/lxc_info.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_info.c b/src/lxc/lxc_info.c
index 7915c0e..4243cf3 100644
--- a/src/lxc/lxc_info.c
+++ b/src/lxc/lxc_info.c
@@ -338,11 +338,17 @@ static int print_info(const char *name, const char *lxcpath)
 			if (c->get_config_item(c, key[i], val, len + 1) != len) {
 				fprintf(stderr, "unable to read %s from configuration\n", key[i]);
 			} else {
-				printf("%s = %s\n", key[i], val);
+				if (!humanize && keys == 1)
+					printf("%s\n", val);
+				else
+					printf("%s = %s\n", key[i], val);
 			}
 			free(val);
 		} else if (len == 0) {
-			printf("%s =\n", key[i]);
+			if (!humanize && keys == 1)
+				printf("\n");
+			else
+				printf("%s =\n", key[i]);
 		} else {
 			fprintf(stderr, "%s invalid\n", key[i]);
 		}
-- 
1.9.rc1



More information about the lxc-devel mailing list