diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b0d688142..f8b57c505 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Tue Oct 9 19:17:53 2001 Christopher Faylor + + * uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in + default condition. + Tue Oct 9 18:53:00 2001 Corinna Vinschen * fhandler.cc (fhandler_disk_file::open): Add missing case clash check. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 58f40ce4a..17898b858 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -834,12 +834,7 @@ _dll_crt0 () if (_cygwin_testing) fork_info = NULL; else if ((fork_info->type & PROC_MAGIC_MASK) == PROC_MAGIC_GENERIC) - api_fatal ("\ -You have multiple copies of cygwin1.dll on your system.\n\ -Search for cygwin1.dll using the Windows Start->Find/Search facility\n\ -and delete all but the most recent version. This will probably be\n\ -the one that resides in x:\\cygwin\\bin, where 'x' is the drive on which\n\ -you have installed the cygwin distribution.\n"); + multiple_cygwin_die (); break; } } @@ -1013,6 +1008,17 @@ __api_fatal (const char *fmt, ...) myself->exit (1); } +void +multiple_cygwin_die () +{ + api_fatal ("\ +You have multiple copies of cygwin1.dll on your system.\n\ +Search for cygwin1.dll using the Windows Start->Find/Search facility\n\ +and delete all but the most recent version. This will probably be\n\ +the one that resides in x:\\cygwin\\bin, where 'x' is the drive on which\n\ +you have installed the cygwin distribution.\n"); +} + #ifdef DEBUGGING void __stdcall cygbench (const char *s) diff --git a/winsup/cygwin/shared.cc b/winsup/cygwin/shared.cc index 81d39e3ed..7aa4d798c 100644 --- a/winsup/cygwin/shared.cc +++ b/winsup/cygwin/shared.cc @@ -107,10 +107,7 @@ shared_info::initialize () if (inited) { if (inited != SHAREDVER) - api_fatal ("Shared region version mismatch. Version %x != %x.\n" - "Are you using multiple versions of cygwin1.dll?\n" - "Run 'cygcheck -r -s -v' to find out.", - inited, SHAREDVER); + multiple_cygwin_die (); return; } 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]) diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 27c4f738e..755d302bb 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -207,6 +207,7 @@ extern bool wsock_started; extern "C" void __api_fatal (const char *, ...) __attribute__ ((noreturn)); extern "C" int __small_sprintf (char *dst, const char *fmt, ...) /*__attribute__ ((regparm (2)))*/; extern "C" int __small_vsprintf (char *dst, const char *fmt, va_list ap) /*__attribute__ ((regparm (3)))*/; +extern void multiple_cygwin_die () __attribute__ ((noreturn)); extern "C" void __malloc_lock (struct _reent *); extern "C" void __malloc_unlock (struct _reent *);