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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 05 Apr 2015 02:48:56 +0100
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Amir Vadai <amirv@...lanox.com>
Cc:	netdev@...r.kernel.org, Or Gerlitz <ogerlitz@...lanox.com>,
	Yevgeny Petrilin <yevgenyp@...lanox.com>,
	Saeed Mahameed <saeedm@...lanox.com>,
	Eyal Perry <eyalpe@...lanox.com>,
	Eyal Grossman <eyalgr@...lanox.com>
Subject: Re: [PATCH ethtool 3/5] ethtool: Return bad status when send_ioctl
 fails

On Sun, 2015-01-25 at 15:51 +0200, Amir Vadai wrote:
> From: Eyal Grossman <eyalgr@...lanox.com>
> 
> Added to ethtool return code(rc != 0) when an error occurs after send_ioctl has fails.
> 
> Signed-off-by: Eyal Grossman <eyalgr@...lanox.com>
> Signed-off-by: Amir Vadai <amirv@...lanox.com>

I wish we could do this, but it's been returning 0 on failure for as
long as git history lasts (10 years) and I would expect this change to
break some scripts.

Maybe we could provide some way to opt-in to this behaviour?

[..]
> @@ -2654,17 +2661,20 @@ static int do_sset(struct cmd_context *ctx)
>  		err = send_ioctl(ctx, &edata);
>  		if (err < 0) {
>  			perror("Cannot get msglvl");
> +			status += err;
>  		} else {
>  			edata.cmd = ETHTOOL_SMSGLVL;
>  			edata.data = ((edata.data & ~msglvl_mask) |
>  				      msglvl_wanted);
>  			err = send_ioctl(ctx, &edata);
> -			if (err < 0)
> +			if (err < 0) {
>  				perror("Cannot set new msglvl");
> +				status += err;
> +			}
>  		}
>  	}
>  
> -	return 0;
> +	return status;

This is going to be a negative number on error, which is not a valid
exit code.  We should generally return 1 on error.

Ben.

>  }
>  
>  static int do_gregs(struct cmd_context *ctx)

-- 
Ben Hutchings
Quantity is no substitute for quality, but it's the only one we've got.

Download attachment "signature.asc" of type "application/pgp-signature" (812 bytes)

Powered by blists - more mailing lists