* 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:
		| @@ -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 | ||||||
|   | |||||||
| @@ -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); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -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"); | ||||||
|  |  | ||||||
| @@ -352,7 +353,7 @@ get_packages (char **argv) { | |||||||
| 	  if (len > package_len) | 	  if (len > package_len) | ||||||
| 	    package_len = len; | 	    package_len = len; | ||||||
| 	  packages[n].name = (char *) malloc (len + 1); | 	  packages[n].name = (char *) malloc (len + 1); | ||||||
| 	  strcpy (packages[n].name , package); | 	  strcpy (packages[n].name, package); | ||||||
| 	  if (f.what[0]) | 	  if (f.what[0]) | ||||||
| 	    strcat (strcat (packages[n].name, "-"), f.what); | 	    strcat (strcat (packages[n].name, "-"), f.what); | ||||||
| 	  packages[n].ver = strdup (f.ver); | 	  packages[n].ver = strdup (f.ver); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user