* 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>
* mkgroup.c (enum_local_groups): Don't skip printing groups when

View File

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

View File

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