lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1508446689-16851-1-git-send-email-greearb@candelatech.com>
Date:   Thu, 19 Oct 2017 13:58:09 -0700
From:   greearb@...delatech.com
To:     netdev@...r.kernel.org
Cc:     linville@...driver.com, Ben Greear <greearb@...delatech.com>
Subject: [PATCH] ethtool:  Do not return error code if no changes were attempted.

From: Ben Greear <greearb@...delatech.com>

This makes it easier to properly handle errors when calling this
from scripts, etc.

Old behaviour:

combined unmodified, ignoring
no channel parameters changed, aborting
current values: tx 0 rx 0 other 1 combined 1
[root@...313-6477 ethtool]# echo $?
1

New behaviour:

combined unmodified, ignoring
no channel parameters changed.
current values: tx 0 rx 0 other 1 combined 1
[root@...313-6477 ethtool]# echo $?
0

Signed-off-by: Ben Greear <greearb@...delatech.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ