[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH 2/2 v2] ash: read $HOME/.profile instead of $(pwd)/.profile
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2013-03-15 1:46:32
Message-ID: 201303150246.32479.vda.linux () googlemail ! com
[Download RAW message or body]

On Sunday 03 March 2013 15:16, Stefan Hellermann wrote:
> ash --login should read ~/.profile instead of .profile in the current
> directory. I noticed it while trying to figure out why /root/.profile
> is only read sometimes.
> 
> Signed-off-by: Stefan Hellermann <stefan@the2masters.de>
> 
> ---
> Version 2:
> - only read .profile if $HOME is set, otherwise skip
> 
> diff --git a/shell/ash.c b/shell/ash.c
> index 7c91a77..6823514 100644
> --- a/shell/ash.c
> +++ b/shell/ash.c
> @@ -13198,7 +13198,13 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
>  		read_profile("/etc/profile");
>   state1:
>  		state = 2;
> -		read_profile(".profile");
> +
> +		const char *hp = lookupvar("HOME");

warning

> +		if(hp) {
> +			hp = concat_path_file(hp, ".profile");
> +			read_profile(hp);
> +			free(hp);

another warning

> +		}
>  	}
>   state2:
>  	state = 3;

Applied.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic