tilde_expand
if (tilde_expand(filename, uid, &ret) != 0)
int tilde_expand(const char *, uid_t, char **);
if (tilde_expand(path, pw->pw_uid, &npath) != 0) {