linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: rt-users <linux-rt-users@vger.kernel.org>,
	Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
Subject: [PATCH 1/6] lib: Rework err_msg_n to output strerror after message
Date: Thu, 14 Aug 2014 18:18:05 +0200	[thread overview]
Message-ID: <1408033090-24866-2-git-send-email-jkacur@redhat.com> (raw)
In-Reply-To: <1408033090-24866-1-git-send-email-jkacur@redhat.com>

Outputting the message first followed by the strerror makes
the error messages more readable.

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c | 4 ++--
 src/lib/error.c             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 4547831fedc9..01dfc75fd70c 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -669,7 +669,7 @@ static int raise_soft_prio(int policy, const struct sched_param *param)
 	err = getrlimit(RLIMIT_RTPRIO, &rlim);
 	if (err) {
 		err = errno;
-		err_msg_n(err, "WARN: getrlimit failed\n");
+		err_msg_n(err, "WARN: getrlimit failed");
 		return err;
 	}
 
@@ -681,7 +681,7 @@ static int raise_soft_prio(int policy, const struct sched_param *param)
 		err = setrlimit(RLIMIT_RTPRIO, &rlim);
 		if (err) {
 			err = errno;
-			err_msg_n(err, "WARN: setrlimit failed\n");
+			err_msg_n(err, "WARN: setrlimit failed");
 			/* return err; */
 		}
 	} else {
diff --git a/src/lib/error.c b/src/lib/error.c
index 1b5de5dabeaf..5eb63527659c 100644
--- a/src/lib/error.c
+++ b/src/lib/error.c
@@ -79,8 +79,8 @@ void fatal(char *fmt, ...)
 
 void err_doit(int err, const char *fmt, va_list ap)
 {
-	if (err)
-		fprintf(stderr, "%s\n", strerror(err));
 	vfprintf(stderr, fmt, ap);
+	if (err)
+		fprintf(stderr, ": %s\n", strerror(err));
 	return;
 }
-- 
1.8.1.4


  reply	other threads:[~2014-08-14 16:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14 16:18 [PATCH 0/6] Miscellaneous cyclictest patches John Kacur
2014-08-14 16:18 ` John Kacur [this message]
2014-08-14 16:18 ` [PATCH 2/6] rt_numa.h: Suppress discards 'const' qualifier warning John Kacur
2014-08-14 16:18 ` [PATCH 3/6] cyclictest: Always print an err message if write of 0 to cpu-dma_latency fails John Kacur
2014-08-14 16:18 ` [PATCH 4/6] cyclictest: Change the output from function sighand() to stderr John Kacur
2014-08-14 16:18 ` [PATCH 5/6] cyclictest: Fix help for long options only John Kacur
2014-08-18 20:26   ` Michael
2014-08-18 20:45     ` John Kacur
2014-08-14 16:18 ` [PATCH 6/6] cyclictest: Add long option --laptop to preserve battery power John Kacur
2014-08-14 16:38   ` John Kacur
2014-08-18 20:29   ` Michael
2014-08-18 20:46     ` John Kacur

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=1408033090-24866-2-git-send-email-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).