Mail Archives: cygwin/2005/05/12/14:54:44
On Thu, May 12, 2005 at 08:23:34PM +0200, Michael Schaap wrote:
>Hi,
>
>Attached is a patch to fix cygstart behaviour when running under "mount
>-X". Cygstart now ensures that the Windows environment is synchronized
>with the Cygwin one.
>(For more details, see the recent thread: "Fixing strace and cygcheck so
>that they work with mount -X")
>
>Chuck, can you, at your convenience, apply this patch and release a new
>version of cygutils?
Didn't we come to the conclusion that you shouldn't be adding PATH to
the environment? I don't see anything which does this in your patch.
cgf
>--- ORIG/cygstart.c 2005-03-08 06:22:51.000000000 +0100
>+++ cygstart.c 2005-05-12 00:37:06.047250000 +0200
>@@ -40,7 +40,7 @@
> #define MSDN_URL "http://msdn.microsoft.com/library/en-us/shellcc/platform/" \
> "Shell/reference/functions/shellexecute.asp"
>
>-static const char versionID[] = "1.0";
>+static const char versionID[] = "1.2";
> /* for future CVS */
> static const char revID[] =
> "$Id: cygstart.c,v 1.3 2005/03/08 05:22:51 cwilson Exp $";
>@@ -64,6 +64,7 @@
> static void help(poptContext optCon, FILE *f, char *name);
> static void version(poptContext optCon, FILE *f, char *name);
> static void license(poptContext optCon, FILE *f, char *name);
>+static void setup_win_environ(void);
>
> int main(int argc, const char **argv)
> {
>@@ -404,6 +405,9 @@
> {
> int ret;
>
>+ /* Need to sync the Windows environment when running under "mount -X" */
>+ setup_win_environ();
>+
> ret = (int) ShellExecute(NULL, action, aPath, args, workDir, show);
> if (ret >= 32) {
> return TRUE;
>@@ -511,3 +515,25 @@
> printTopDescription(f, name);
> printLicense(f, name);
> }
>+
>+/* Copy cygwin environment variables to the Windows environment if they're not
>+ * already there. */
>+static void setup_win_environ(void)
>+{
>+ char **envp = environ;
>+ char *var, *val;
>+ char curval[2];
>+
>+ while (envp && *envp) {
>+ var = strdup(*envp++);
>+ val = strchr(var, '=');
>+ *val++ = '\0';
>+
>+ if (GetEnvironmentVariable(var, curval, 2) == 0
>+ && GetLastError() == ERROR_ENVVAR_NOT_FOUND) {
>+ SetEnvironmentVariable(var, val);
>+ }
>+
>+ free(var);
>+ }
>+}
>
>
>--
>Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
>Problem reports: http://cygwin.com/problems.html
>Documentation: http://cygwin.com/docs.html
>FAQ: http://cygwin.com/faq/
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -