diff options
author | Christopher Faylor <me@cgf.cx> | 2001-10-10 03:28:24 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2001-10-10 03:28:24 +0400 |
commit | d3fee5eccbdbc3d22aad40f6ddb9d16cd2343588 (patch) | |
tree | ea05b23ea531baa46d9efc8d9f181140c160472a /winsup/cygwin/uinfo.cc | |
parent | 132a3b30b9b67eab414bc185537ab6ed4e9eab4d (diff) |
* uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in default
condition.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 9bbbe9e9c..bed8ba9a0 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -83,14 +83,15 @@ internal_getlogin (cygheap_user &user) /* HOMEDRIVE and HOMEPATH are wrong most of the time, too, after changing user context! */ sys_mbstowcs (wuser, user.name (), UNLEN + 1); - wlogsrv[0] = '\0'; - if (user.logsrv ()) + if (NetUserGetInfo (NULL, wuser, 3, (LPBYTE *) &ui) && user.logsrv ()) { strcat (strcpy (buf, "\\\\"), user.logsrv ()); sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3); + ui = NULL; + if (NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *) &ui)) + ui = NULL; } - if (!NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui) - || (wlogsrv[0] && !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui))) + if (ui) { sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH); if (!buf[0]) |