[9493] in Athena Bugs
Re: rt 7.3P: purge dumps core
daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Thu Jun 18 13:59:39 1992
Date: Thu, 18 Jun 92 13:59:19 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@Athena.MIT.EDU, ckclark@Athena.MIT.EDU, bug-delete@Athena.MIT.EDU
In-Reply-To: [9488]
This patch should fix this problem:
*** 1.22 1991/06/25 16:14:09
--- directories.c 1992/06/18 17:54:05
***************
*** 368,374 ****
void print_paths_from(leaf)
filerec *leaf;
{
! char buf[MAXPATHLEN];
printf("%s\n", get_leaf_path(leaf, buf));
if (leaf->dirs)
--- 368,378 ----
void print_paths_from(leaf)
filerec *leaf;
{
! /*
! * This is static to prevent multiple copies of it when calling
! * recursively.
! */
! static char buf[MAXPATHLEN];
printf("%s\n", get_leaf_path(leaf, buf));
if (leaf->dirs)
***************
*** 383,389 ****
void print_specified_paths_from(leaf)
filerec *leaf;
{
! char buf[MAXPATHLEN];
if (leaf->specified)
printf("%s\n", get_leaf_path(leaf, buf));
--- 387,397 ----
void print_specified_paths_from(leaf)
filerec *leaf;
{
! /*
! * This is static to prevent multiple copies of it when calling
! * recursively.
! */
! static char buf[MAXPATHLEN];
if (leaf->specified)
printf("%s\n", get_leaf_path(leaf, buf));
***************
*** 662,673 ****
char ***in_strings;
int *num;
{
- char newname[MAXPATHLEN];
char **strings;
int retval;
strings = *in_strings;
if (leaf->specified) {
*num += 1;
strings = (char **) realloc((char *) strings, (unsigned)
(sizeof(char *) * (*num)));
--- 670,687 ----
char ***in_strings;
int *num;
{
char **strings;
int retval;
strings = *in_strings;
if (leaf->specified) {
+ /*
+ * This array is static so that only one copy of it is allocated,
+ * rather than one copy on the stack for each recursive
+ * invocation of accumulate_names.
+ */
+ static char newname[MAXPATHLEN];
+
*num += 1;
strings = (char **) realloc((char *) strings, (unsigned)
(sizeof(char *) * (*num)));
*** 1.21 1991/06/25 16:14:18
--- expunge.c 1992/06/18 17:48:40
***************
*** 291,297 ****
int retval;
if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
! char buf[MAXPATHLEN];
if (retval = get_leaf_path(leaf, buf)) {
error("get_leaf_path");
--- 291,301 ----
int retval;
if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
! /*
! * This is static so that we don't create a copy of it for
! * every recursive invocation of expunge_specified.
! */
! static char buf[MAXPATHLEN];
if (retval = get_leaf_path(leaf, buf)) {
error("get_leaf_path");
It has been applied in /mit/delete/src.
jik