Skip to contentSkip to conversation

chmem: Remove commit - chmem print warnings about failures always

PATCH Applied Sumanth Korikkar 2 participants 2 messages Aug 22, 2025 – Aug 26, 2025 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chmem: Remove commit - chmem print warnings about failures always

Users do not care which blocks are set offline, when using size option Consistently printing warnings/errors in this case may confuse them and create the false impression that the enable/disable operation itself has failed.

If size option succeeds, chmem should not print errors/warnings.

Hence, revert commit
48675a744 ("chmem: print warnings about failures always (not only with --verbose)")

---
Add signed-off-by

 sys-utils/chmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sys-utils/chmem.c +4 -4
index 52e6f49b3..bee2a90f8 100644
@@ -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) {
+		if (rc != 0 && desc->verbose) {
 			if (enable)
-				warn(_("%s enable failed"), str);
+				fprintf(stdout, _("%s enable failed\n"), str);
 			else
-				warn(_("%s disable failed"), str);
-		} else if (desc->verbose) {
+				fprintf(stdout, _("%s disable failed\n"), str);
+		} else if (rc == 0 && desc->verbose) {
 			if (enable)
 				fprintf(stdout, _("%s enabled\n"), str);
 			else
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Sumanth Korikkar
 sys-utils/chmem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com