This fixes a bug reported by Jose Pedro Oliveira.
(dump_file): Use offsetof when computing sizes for
struct hack; this avoids wasted space in some cases.
if (1 < current_stat.st_nlink)
{
static Hash_table *link_table;
- struct link *lp = xmalloc (sizeof *lp + strlen (p));
+ struct link *lp = xmalloc (offsetof (struct link, name)
+ + strlen (p) + 1);
struct link *dup;
lp->ino = current_stat.st_ino;
lp->dev = current_stat.st_dev;
if (dup != lp)
{
/* We found a link. */
- char const *link_name = dup->name;
+ char const *link_name = relativize (dup->name);
free (lp);