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>, bhutchings@solarflare.com
Subject: Re: [PATCH] ethtool: return non-zero from do_sset() when any of ETHTOOL_{G,S}* fails
Date: Wed, 25 Mar 2015 17:58:27 +0100	[thread overview]
Message-ID: <5512E933.60301@redhat.com> (raw)
In-Reply-To: <1423236283-32446-1-git-send-email-ivecera@redhat.com>

On 02/06/2015 04:24 PM, Ivan Vecera wrote:
> 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)
>
Ben, any comment on this?

Ivan

  reply	other threads:[~2015-03-25 16:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=5512E933.60301@redhat.com \
    --to=ivecera@redhat.com \
    --cc=ben@decadent.org.uk \
    --cc=bhutchings@solarflare.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;
as well as URLs for NNTP newsgroup(s).