X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=b3de6a87d33a42c8ca9bc5243cd8c162bb9c6bcc;hb=eb5c8f4b8b84e341eec47833ccc9401b9293a0cf;hp=98b16394cbc1807cecbfad76e3525079635e660d;hpb=4bb7c67e043f5103e63d715ae49fb27c6ae60e1e;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 98b1639..b3de6a8 100644 --- a/src/create.c +++ b/src/create.c @@ -1139,7 +1139,8 @@ dump_file (char *p, int top_level, dev_t parent_device) 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; @@ -1154,7 +1155,7 @@ dump_file (char *p, int top_level, dev_t parent_device) if (dup != lp) { /* We found a link. */ - char const *link_name = dup->name; + char const *link_name = relativize (dup->name); free (lp);