Util-Linux package development
 help / color / mirror / Atom feed
From: Benno Schulenberg <bensberg@telfort.nl>
To: util-linux@vger.kernel.org
Subject: [PATCH 04/11] chmem: print warnings about failures always (not only with --verbose)
Date: Tue, 25 Mar 2025 11:42:58 +0100	[thread overview]
Message-ID: <20250325104305.23980-4-bensberg@telfort.nl> (raw)
In-Reply-To: <20250325104305.23980-1-bensberg@telfort.nl>

This makes the handling of errors the same as some 90 lines down.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
 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


  parent reply	other threads:[~2025-03-25 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 10:42 [PATCH 01/11] ipcrm: move a constant argument in order to gettextize the message Benno Schulenberg
2025-03-25 10:42 ` [PATCH 02/11] ipcrm: in usage text, use two lines when option+arguments is very long Benno Schulenberg
2025-03-25 10:42 ` [PATCH 03/11] ipcutils, lsipc: unabbreviate two words in some error messages Benno Schulenberg
2025-03-25 10:42 ` Benno Schulenberg [this message]
2025-03-25 10:42 ` [PATCH 05/11] chmem: (man) add missing end-of-bold marker, and add missing OR bar Benno Schulenberg
2025-03-25 10:43 ` [PATCH 06/11] fstrim: mark only the mountpoint as placeholder, not options -A and -a Benno Schulenberg
2025-03-25 10:43 ` [PATCH 07/11] swapon: improve a translator hint, and remove a pointless one Benno Schulenberg
2025-03-25 10:43 ` [PATCH 08/11] mkfs.cramfs: reduce the synopsis to the standard, succinct form Benno Schulenberg
2025-03-25 10:43 ` [PATCH 09/11] mkfs.cramfs: vertically align the option descriptions of the usage text Benno Schulenberg
2025-03-25 10:43 ` [PATCH 10/11] mkfs.cramfs: (man) mark arguments of -N and -l in bold, not italics Benno Schulenberg
2025-03-25 10:43 ` [PATCH 11/11] ipcs: align the first group of options with later ones in the usage text Benno Schulenberg
2025-03-27  9:54 ` [PATCH 01/11] ipcrm: move a constant argument in order to gettextize the message Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250325104305.23980-4-bensberg@telfort.nl \
    --to=bensberg@telfort.nl \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox