Ralph wrote:

> Hi David,
>
> > And my feeling at this point is to put out an RC3 with the 1.7
> > behavior for $HOME.
>
> Which, to be clear, is not the behaviour Ken and kre want.  :-)

I was thinking that just removing the if (!*var) statement from your
code, leaving:

    char *var = getenv("HOME");
    if (var) {
        mypath = mh_xstrdup(var);
        return;
    }

    errno = 0;
    struct passwd *pw = getpwuid(getuid());
    if (!pw) {
        if (errno)
            adios("", "getpwuid() failed");   /* "" prints errno! */
        die("password entry not found");
    }
    if (!*pw->pw_dir)
        die("password entry has empty home directory");

    mypath = mh_xstrdup(pw->pw_dir);

is the same as the 1.7 code (ignoring the string copies):

    if ((mypath = getenv("HOME")) == NULL) {
        if ((pw = getpwuid(getuid())) == NULL || *pw->pw_dir == '\0')
            adios(NULL, "cannot determine your home directory");
        else
            mypath = pw->pw_dir;
    }

What case am I missing?

David

Reply via email to