if (result == 0 && pwd.pw_dir != NULL)
if (result == 0 && tpwd != NULL && pwd.pw_dir != NULL)
parse_tilde (char **word, size_t *word_length, size_t *max_length,	     const char *words, size_t *offset, size_t wordc){  /* We are poised _at_ a tilde */  size_t i;  if (*word_length != 0)    {      if (!((*word)[*word_length - 1] == '=' && wordc == 0))	{	  if (!((*word)[*word_length - 1] == ':'		&& strchr (*word, '=') && wordc == 0))	    {	      *word = w_addchar (*word, word_length, max_length, '~');	      return *word ? 0 : WRDE_NOSPACE;	    }	}    }  for (i = 1 + *offset; words[i]; i++)    {      if (words[i] == ':' || words[i] == '/' || words[i] == ' ' ||	  words[i] == '\t' || words[i] == 0 )	break;      if (words[i] == '\\')	{	  *word = w_addchar (*word, word_length, max_length, '~');	  return *word ? 0 : WRDE_NOSPACE;	}    }  if (i == 1 + *offset)    {      /* Tilde appears on its own */      uid_t uid;      struct passwd pwd, *tpwd;      int buflen = 1000;      char* buffer = __alloca (buflen);      int result;      uid = __getuid ();      while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0	     && errno == ERANGE)	{	  buflen += 1000;	  buffer = __alloca (buflen);	}      if (result == 0 && pwd.pw_dir != NULL)	{	  *word = w_addstr (*word, word_length, max_length, pwd.pw_dir);	  if (*word == NULL)	    return WRDE_NOSPACE;	}      else	{	  *word = w_addchar (*word, word_length, max_length, '~');	  if (*word == NULL)	    return WRDE_NOSPACE;	}    }  else    {      /* Look up user name in database to get home directory */      char *user = __strndup (&words[1 + *offset], i - *offset);      struct passwd pwd, *tpwd;      int buflen = 1000;      char* buffer = __alloca (buflen);      int result;      while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0	     && errno == ERANGE)	{	  buflen += 1000;	  buffer = __alloca (buflen);	}      if (result == 0 && pwd.pw_dir)	*word = w_addstr (*word, word_length, max_length, pwd.pw_dir);      else	{	  /* (invalid login name) */	  *word = w_addchar (*word, word_length, max_length, '~');	  if (*word != NULL)	    *word = w_addstr (*word, word_length, max_length, user);	}      *offset = i - 1;    }  return *word ? 0 : WRDE_NOSPACE;}