]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chmem: Remove commit - chmem print warnings about failures always
authorSumanth Korikkar <sumanthk@linux.ibm.com>
Fri, 22 Aug 2025 15:13:53 +0000 (17:13 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 26 Aug 2025 09:15:40 +0000 (11:15 +0200)
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)")

Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
sys-utils/chmem.c

index 52e6f49b3f7364703bab19d916e0805b41fabc75..bee2a90f8cb632b471906652f2a9712507372fed 100644 (file)
@@ -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