bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for 3.80rc1, [was: GNU make 3.80 rc1]


From: Philip Guenther
Subject: Patch for 3.80rc1, [was: GNU make 3.80 rc1]
Date: Tue, 16 Jul 2002 22:53:45 -0700

There are a few serious bugs in 3.80rc1 that I immediately ran
into when testing:

1) free() gets called with garbage if opendir() fails.
2) file handles are leaked when processing include files.
3) appending to a simply expanded variable doesn't work.


The patch below fixes all of them, at least for me.  I've sent this
to Paul Smith for inclusion in the next release candidate, but
since he's going to be away for a couple weeks, I figured sending
a copy to the lists may head off headaches and/or debugging efforts
in others.

Enjoy!


Philip Guenther
address@hidden

----------

*** dir.c       Thu Jul 11 17:48:03 2002
--- dir.c       Tue Jul 16 22:45:00 2002
***************
*** 546,552 ****
              if (dc->dirstream == 0)
                  /* Couldn't open the directory.  Mark this by
                     setting the `files' member to a nil pointer.  */
!               hash_free (&dc->dirfiles, 0);
              else
                {
                  hash_init (&dc->dirfiles, DIRFILE_BUCKETS,
--- 546,552 ----
              if (dc->dirstream == 0)
                  /* Couldn't open the directory.  Mark this by
                     setting the `files' member to a nil pointer.  */
!               dc->dirfiles.ht_vec = 0;
              else
                {
                  hash_init (&dc->dirfiles, DIRFILE_BUCKETS,
*** read.c      Thu Jul 11 17:48:03 2002
--- read.c      Tue Jul 16 22:47:25 2002
***************
*** 380,385 ****
--- 380,387 ----
  
    reading_file = curfile;
  
+   fclose(ebuf.fp);
+ 
    free(ebuf.bufstart);
    return r;
  }
*** variable.c  Tue Jul 16 23:19:06 2002
--- variable.c  Tue Jul 16 23:22:13 2002
***************
*** 744,749 ****
--- 744,750 ----
              /* Paste the old and new values together in VALUE.  */
  
              unsigned int oldlen, newlen;
+             char *new_value;
  
              p = value;
              if (v->recursive)
***************
*** 760,769 ****
  
              oldlen = strlen (v->value);
              newlen = strlen (p);
!             p = (char *) alloca (oldlen + 1 + newlen + 1);
!             bcopy (v->value, p, oldlen);
!             p[oldlen] = ' ';
!             bcopy (value, &p[oldlen + 1], newlen + 1);
            }
        }
      }
--- 761,771 ----
  
              oldlen = strlen (v->value);
              newlen = strlen (p);
!             new_value = (char *) alloca (oldlen + 1 + newlen + 1);
!             bcopy (v->value, new_value, oldlen);
!             new_value[oldlen] = ' ';
!             bcopy (p, &new_value[oldlen + 1], newlen + 1);
!             p = new_value;
            }
        }
      }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]