From a2085837506765480f73379f21702904a5ca613c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 21 Oct 2014 10:59:40 +0000 Subject: [PATCH] * cygcheck.cc (CYGLSA64_DLL): Remove unused macro. (dump_sysinfo): If COMSPEC isn't set in the MSVCRT environment, set it. Explain why. --- winsup/utils/ChangeLog | 6 ++++++ winsup/utils/cygcheck.cc | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 9e0e82342..c36bd0c46 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,9 @@ +2014-10-21 Corinna Vinschen + + * cygcheck.cc (CYGLSA64_DLL): Remove unused macro. + (dump_sysinfo): If COMSPEC isn't set in the MSVCRT environment, set it. + Explain why. + 2014-09-03 Corinna Vinschen * setfacl.c (addmissing): New function to add missing acl entries to diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index 465bc7861..cc400519e 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -1,7 +1,7 @@ /* cygcheck.cc Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. + 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc. This file is part of Cygwin. @@ -587,9 +587,6 @@ cygwin_info (HANDLE h) return; } -/* Special case. Don't complain about this one. */ -#define CYGLSA64_DLL "\\cyglsa64.dll" - static void dll_info (const char *path, HANDLE fh, int lvl, int recurse) { @@ -1436,6 +1433,20 @@ dump_sysinfo () DWORD obcaseinsensitive = 1; HKEY key; + /* MSVCRT popen (called by pretty_id and dump_sysinfo_services) SEGVs if + COMSPEC isn't set correctly. Simply enforce it here. Using + Get/SetEnvironmentVariable to set the dir does *not* help, btw. + Apparently MSVCRT keeps its own copy of the environment and changing + that requires to use _wputenv. */ + if (!_wgetenv (L"COMSPEC")) + { + WCHAR comspec[MAX_PATH + 17]; + wcscpy (comspec, L"COMSPEC="); + GetSystemDirectoryW (comspec + 8, MAX_PATH); + wcsncat (comspec, L"\\cmd.exe", sizeof comspec); + _wputenv (comspec); + } + printf ("\nCygwin Configuration Diagnostics\n"); time (&now); printf ("Current System Time: %s\n", ctime (&now));