Skip to contentSkip to conversation

ethtool: Do not return error code if no changes were attempted.

PATCH New [email protected] 1 participant 1 message Oct 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ethtool: Do not return error code if no changes were attempted.

From: Ben Greear <[email protected]>

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

---

v2: Fix comments, the # ./ethtool .... was removed by git of course.

 ethtool.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ethtool.c +2 -2
index ad18704..224efdb 100644
@@ -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;
Signature · 1 line
2.7.5