Ticket #39018: patch-src_archives.c.diff

File patch-src_archives.c.diff, 1.0 KB (added by cooljeanius (Eric Gallager), 11 years ago)

patch for src/archives.c

  • src/archives.c

    old new  
    712712{
    713713  static struct varbuf conffderefn, symlinkfn;
    714714  const char *usename;
     715  char *s = NULL;
    715716  struct filenamenode *usenode;
    716717
    717718  struct conffile *conff;
     
    771772    st = &ti->stat;
    772773
    773774  usenode = namenodetouse(nifd->namenode, tc->pkg, &tc->pkg->available);
    774   usename = usenode->name + 1; /* Skip the leading '/'. */
     775  usename = usenode->name; /* Skip the leading '/' */
     776  if (*usename == '.' && *usename + 1 == '/') {
     777        usename += 1; /* Skip the leading `.' */
     778  } else if (*usename != '/') {
     779        s = malloc(strlen(usename) + 2); /* 1 for NULL, one for `/' we're going to add */
     780        strcpy(s + 1, usename);
     781        *s = '/';
     782        usename = s;
     783  }
    775784
    776785  trig_file_activate(usenode, tc->pkg);
    777786
     
    784793  }
    785794
    786795  setupfnamevbs(usename);
     796   
     797  if (s != NULL) {
     798    free(s);
     799  }
    787800
    788801  statr= lstat(fnamevb.buf,&stab);
    789802  if (statr) {