From: greearb@candelatech.com
To: netdev@vger.kernel.org
Cc: linville@tuxdriver.com, Ben Greear <greearb@candelatech.com>
Subject: [PATCH v2] ethtool: Do not return error code if no changes were attempted.
Date: Thu, 19 Oct 2017 14:01:19 -0700 [thread overview]
Message-ID: <1508446879-17056-1-git-send-email-greearb@candelatech.com> (raw)
From: Ben Greear <greearb@candelatech.com>
This makes it easier to properly handle errors when calling this
from scripts, etc.
Old behaviour:
$ ethtool -L eth3 combined 1
combined unmodified, ignoring
no channel parameters changed, aborting
current values: tx 0 rx 0 other 1 combined 1
[root@lf0313-6477 ethtool]# echo $?
1
New behaviour:
$ ./ethtool -L eth3 combined 1
combined unmodified, ignoring
no channel parameters changed.
current values: tx 0 rx 0 other 1 combined 1
[root@lf0313-6477 ethtool]# echo $?
0
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2: Fix comments, the # ./ethtool .... was removed by git of course.
ethtool.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ethtool.c b/ethtool.c
index ad18704..224efdb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -1994,12 +1994,12 @@ static int do_schannels(struct cmd_context *ctx)
&changed);
if (!changed) {
- fprintf(stderr, "no channel parameters changed, aborting\n");
+ fprintf(stderr, "no channel parameters changed.\n");
fprintf(stderr, "current values: tx %u rx %u other %u"
" combined %u\n", echannels.rx_count,
echannels.tx_count, echannels.other_count,
echannels.combined_count);
- return 1;
+ return 0;
}
echannels.cmd = ETHTOOL_SCHANNELS;
--
2.7.5
reply other threads:[~2017-10-19 21:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1508446879-17056-1-git-send-email-greearb@candelatech.com \
--to=greearb@candelatech.com \
--cc=linville@tuxdriver.com \
--cc=netdev@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