netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ethtool: return non-zero from do_sset() when any of ETHTOOL_{G,S}* fails
@ 2015-02-06 15:24 Ivan Vecera
  2015-03-25 16:58 ` Ivan Vecera
  2015-04-05  1:55 ` Ben Hutchings
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Vecera @ 2015-02-06 15:24 UTC (permalink / raw)
  To: netdev; +Cc: Ben Hutchings

Function do_sset returns unconditionally zero error code without regard
to return value of ETHTOOL_{G,S}* ioctls.

Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 ethtool.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index bf583f3..c004d41 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2357,7 +2357,7 @@ static int do_sset(struct cmd_context *ctx)
 	int argc = ctx->argc;
 	char **argp = ctx->argp;
 	int i;
-	int err;
+	int err, result = 0;
 
 	for (i = 0; i < ARRAY_SIZE(flags_msglvl); i++)
 		flag_to_cmdline_info(flags_msglvl[i].name,
@@ -2617,6 +2617,7 @@ static int do_sset(struct cmd_context *ctx)
 				fprintf(stderr, "  not setting transceiver\n");
 			if (mdix_wanted != -1)
 				fprintf(stderr, "  not setting mdix\n");
+			result = err;
 		}
 	}
 
@@ -2650,6 +2651,7 @@ static int do_sset(struct cmd_context *ctx)
 				fprintf(stderr, "  not setting wol\n");
 			if (sopass_change)
 				fprintf(stderr, "  not setting sopass\n");
+			result = err;
 		}
 	}
 
@@ -2668,9 +2670,10 @@ static int do_sset(struct cmd_context *ctx)
 			if (err < 0)
 				perror("Cannot set new msglvl");
 		}
+		result = err;
 	}
 
-	return 0;
+	return result;
 }
 
 static int do_gregs(struct cmd_context *ctx)
-- 
2.0.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-05  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 15:24 [PATCH] ethtool: return non-zero from do_sset() when any of ETHTOOL_{G,S}* fails Ivan Vecera
2015-03-25 16:58 ` Ivan Vecera
2015-04-05  1:55 ` Ben Hutchings

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).