{
struct dir *dir, *curdir;
struct stat statbuf;
+ char* mname = NULL;
if (dstack[cidx].dir != NULL)
return 1;
return 0;
}
- if (!dir && ((dir = adddir(vol, curdir, dstack[cidx].lname, strlen(dstack[cidx].lname),
+ mname = utompath(vol, dstack[cidx].lname);
+ if (!dir && ((dir = adddir(vol, curdir, mname, strlen(mname),
dstack[cidx].path, strlen(dstack[cidx].path), &statbuf)) == NULL))
return 0;
dstack[cidx].dir = dir;
static int rslt_add(struct vol *vol, struct stat *statbuf, char *fname, short cidx, int isdir, char **rbuf)
{
char *p = *rbuf;
- int l = fname != NULL ? strlen(fname) : 0;
+ char *savefname = (fname != NULL) ? strdup (fname) : NULL;
+ int l = savefname != NULL ? strlen(savefname) : 0;
u_int32_t did;
char p0;
}
/* Fill offset of returned file name */
- if (fname != NULL) {
+ if (savefname != NULL) {
*p++ = 0;
*p++ = (int)(p - *rbuf) - 1;
p[0] = l;
- strcpy(p+1, fname);
+ strcpy(p+1, savefname);
p += l + 1;
}
*rbuf = p;
/* *rbuf[0] = (int)(p-*rbuf); */
+ free (savefname);
return 1;
} /* rslt_add */
/* File attribute bits... */
if (c1.rbitmap & (1 << FILPBIT_ATTR)) {
- memcpy(&c1.attr, ibuf, sizeof(c1.attr));
+ memcpy(&c1.attr, spec1, sizeof(c1.attr));
spec1 += sizeof(c1.attr);
c1.attr = ntohs(c1.attr);
- memcpy(&c2.attr, ibuf, sizeof(c2.attr));
+ memcpy(&c2.attr, spec2, sizeof(c2.attr));
spec2 += sizeof(c1.attr);
c2.attr = ntohs(c2.attr);
}
}
/* Finder info */
- if (c1.rbitmap * (1 << FILPBIT_FINFO)) {
+ if (c1.rbitmap & (1 << FILPBIT_FINFO)) {
memcpy(&c1.finfo, spec1, sizeof(c1.finfo));
spec1 += sizeof(c1.finfo);
memcpy(&c2.finfo, spec2, sizeof(c2.finfo));