* cygcheck.cc (nuke): Use malloc rather than alloca for environment variables.

(load_cygwin): Ditto.
* dump_setup.cc (parse_filename): Cosmetic changes.
(get_packages): Ditto.
This commit is contained in:
Christopher Faylor 2008-08-27 20:11:11 +00:00
parent 2d8d8175f1
commit 25687b0f76
3 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2008-08-27 Christopher Faylor <me+cygwin@cgf.cx>
* cygcheck.cc (nuke): Use malloc rather than alloca for environment
variables.
(load_cygwin): Ditto.
* dump_setup.cc (parse_filename): Cosmetic changes.
(get_packages): Ditto.
2008-08-25 Corinna Vinschen <corinna@vinschen.de> 2008-08-25 Corinna Vinschen <corinna@vinschen.de>
* mkgroup.c (enum_local_groups): Don't skip printing groups when * mkgroup.c (enum_local_groups): Don't skip printing groups when

View File

@ -2003,7 +2003,7 @@ void
nuke (char *ev) nuke (char *ev)
{ {
int n = 1 + strchr (ev, '=') - ev; int n = 1 + strchr (ev, '=') - ev;
char *s = (char *) alloca (n + 1); char *s = (char *) malloc (n + 1);
memcpy (s, ev, n); memcpy (s, ev, n);
s[n] = '\0'; s[n] = '\0';
putenv (s); putenv (s);
@ -2051,7 +2051,7 @@ load_cygwin (int& argc, char **&argv)
} }
for (char **ev = envp; *ev; ev++) for (char **ev = envp; *ev; ev++)
if (strncmp (*ev, "PATH=", 5) != 0) if (strncmp (*ev, "PATH=", 5) != 0)
putenv (*ev); putenv (strdup (*ev));
if (path) if (path)
putenv (path); putenv (path);
} }

View File

@ -94,14 +94,14 @@ parse_filename (const char *in_fn, fileparse& f)
if (*ver == '-') if (*ver == '-')
if (isdigit (ver[1])) if (isdigit (ver[1]))
{ {
*ver++ = 0; *ver++ = '\0';
strcpy (f.pkg, p); strcpy (f.pkg, p);
break; break;
} }
else if (strcasecmp (ver, "-src") == 0 || else if (strcasecmp (ver, "-src") == 0 ||
strcasecmp (ver, "-patch") == 0) strcasecmp (ver, "-patch") == 0)
{ {
*ver++ = 0; *ver++ = '\0';
strcpy (f.pkg, p); strcpy (f.pkg, p);
strcpy (f.what, strlwr (ver)); strcpy (f.what, strlwr (ver));
strcpy (f.pkgtar, p); strcpy (f.pkgtar, p);
@ -311,7 +311,8 @@ check_package_files (int verbose, char *package)
* The last entry in the list is {NULL,NULL}. * The last entry in the list is {NULL,NULL}.
*/ */
static pkgver * static pkgver *
get_packages (char **argv) { get_packages (char **argv)
{
char *setup = cygpath ("/etc/setup/installed.db", NULL); char *setup = cygpath ("/etc/setup/installed.db", NULL);
FILE *fp = fopen (setup, "rt"); FILE *fp = fopen (setup, "rt");