[PATCH 1/3] net/ifup.c: don't fail silently

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 23 03:30:42 PDT 2014


On Wed, Apr 23, 2014 at 11:19:24AM +0200, Juergen Borleis wrote:
> Since commit a162dfe50345d3461010759f8a0e79f7e388c140 the ifup command is implemented in C and runs up to two external scripts.
> If one of these scripts return with an error code, the command terminates silently. This can confuse a user because there is
> no hint about the reason why it fails. Add error messages to avoid this case.
> 
> Signed-off-by: Juergen Borleis <jbe at pengutronix.de>
> ---
>  net/ifup.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ifup.c b/net/ifup.c
> index 7b63136..c74120c 100644
> --- a/net/ifup.c
> +++ b/net/ifup.c
> @@ -70,14 +70,18 @@ int ifup(const char *name, unsigned flags)
>  	cmd_discover = asprintf("/env/network/%s-discover", name);
>  
>  	ret = run_command(cmd);
> -	if (ret)
> +	if (ret) {
> +		pr_err("Running '%s' fails\n", cmd);

It failed, not it fails. Also, please print the error code along with
the message.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list