netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Vecera <ivecera@redhat.com>
To: netdev@vger.kernel.org
Cc: Ben Hutchings <ben@decadent.org.uk>
Subject: [PATCH] ethtool: return non-zero from do_sset() when any of ETHTOOL_{G,S}* fails
Date: Fri,  6 Feb 2015 16:24:43 +0100	[thread overview]
Message-ID: <1423236283-32446-1-git-send-email-ivecera@redhat.com> (raw)

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

             reply	other threads:[~2015-02-06 15:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 15:24 Ivan Vecera [this message]
2015-03-25 16:58 ` [PATCH] ethtool: return non-zero from do_sset() when any of ETHTOOL_{G,S}* fails Ivan Vecera
2015-04-05  1:55 ` Ben Hutchings

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=1423236283-32446-1-git-send-email-ivecera@redhat.com \
    --to=ivecera@redhat.com \
    --cc=ben@decadent.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).