Re: [PATCH] config --get --path: check for unset $HOME
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 26, 2010, 16:35 UTC
- Message-ID
- <AANLkTimf73aczIILlQ5N_id97kJNmGAUf0QLlMl8my2r@mail.gmail.com>
- In-Reply-To
- <20100726150651.GA4021@burratino>
On Mon, Jul 26, 2010 at 15:06, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 8 quoted lines
> size_t username_len = first_slash - username;
> if (username_len == 0) {
> const char *home = getenv("HOME");
> + if (!home)
> + goto return_null;
> strbuf_add(&user_path, home, strlen(home));
> } else {
> struct passwd *pw = getpw_str(username, username_len);Should we maybe fall back on checking pw_dir in getpwuid() if $HOME isn't set?