* uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in default

condition.
This commit is contained in:
Christopher Faylor 2001-10-09 23:28:24 +00:00
parent 132a3b30b9
commit d3fee5eccb
5 changed files with 24 additions and 14 deletions

View File

@ -1,3 +1,8 @@
Tue Oct 9 19:17:53 2001 Christopher Faylor <cgf@cygnus.com>
* uinfo.cc (internal_getlogin): Reorganize slightly to minimize work in
default condition.
Tue Oct 9 18:53:00 2001 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_disk_file::open): Add missing case clash check.

View File

@ -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)

View File

@ -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;
}

View File

@ -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])

View File

@ -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 *);