[PATCH 04/11] chmem: print warnings about failures always (not only with --verbose)

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
This makes the handling of errors the same as some 90 lines down.

Signed-off-by: Benno Schulenberg <[email protected]>
---
 sys-utils/chmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 4105d1969..5ff344fd3 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -146,12 +146,12 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
 
 		idxtostr(desc, index, str, sizeof(str));
 		rc = ul_path_writef_string(desc->sysmem, onoff, "%s/state", name);
-		if (rc != 0 && desc->verbose) {
+		if (rc != 0) {
 			if (enable)
-				fprintf(stdout, _("%s enable failed\n"), str);
+				warn(_("%s enable failed"), str);
 			else
-				fprintf(stdout, _("%s disable failed\n"), str);
-		} else if (rc == 0 && desc->verbose) {
+				warn(_("%s disable failed"), str);
+		} else if (desc->verbose) {
 			if (enable)
 				fprintf(stdout, _("%s enabled\n"), str);
 			else
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.