*
* @note If the passed ret->m_name is mangled, we'll demangle it
*/
-static int cname_mtouname(const struct vol *vol, const struct dir *dir, struct path *ret, int toUTF8)
+static int cname_mtouname(const struct vol *vol, struct dir *dir, struct path *ret, int toUTF8)
{
static char temp[ MAXPATHLEN + 1];
char *t;
/* check for OS X mangled filename :( */
t = demangle_osx(vol, ret->m_name, dir->d_did, &fileid);
+
+ if (curdir == NULL) {
+ /* demangle_osx() calls dirlookup() which might have clobbered curdir */
+ movecwd(vol, dir);
+ }
+
LOG(log_maxdebug, logtype_afpd, "cname_mtouname('%s',did:%u) {demangled:'%s', fileid:%u}",
ret->m_name, ntohl(dir->d_did), t, ntohl(fileid));
cfrombstr(l->entry[i]),
blength(l->entry[i]))) == NULL) {
- if ((cnid = cnid_add(vol->v_cdb, /* 6. */
- &st,
- did,
- cfrombstr(l->entry[i]),
- blength(l->entry[i]),
- 0)) == CNID_INVALID)
+ AFP_CNID_START("cnid_add");
+ cnid = cnid_add(vol->v_cdb, /* 6. */
+ &st,
+ did,
+ cfrombstr(l->entry[i]),
+ blength(l->entry[i]),
+ 0);
+ AFP_CNID_DONE();
+ if (cnid == CNID_INVALID)
EC_FAIL;
if ((dir = dirlookup(vol, cnid)) == NULL) /* 7. */
/* Get it from the database */
cnid = did;
LOG(log_debug, logtype_afpd, "dirlookup(did: %u): querying CNID database", ntohl(did));
- if ((upath = cnid_resolve(vol->v_cdb, &cnid, buffer, buflen)) == NULL) {
+
+ AFP_CNID_START("cnid_resolve");
+ upath = cnid_resolve(vol->v_cdb, &cnid, buffer, buflen);
+ AFP_CNID_DONE();
+ if (upath == NULL) {
afp_errno = AFPERR_NOOBJ;
err = 1;
goto exit;
cnid_t id;
struct adouble ad;
struct adouble *adp = NULL;
- bstring fullpath;
+ bstring fullpath = NULL;
AFP_ASSERT(vol);
AFP_ASSERT(dir);
void dir_free_invalid_q(void)
{
struct dir *dir;
- while (dir = (struct dir *)dequeue(invalid_dircache_entries))
+ while ((dir = (struct dir *)dequeue(invalid_dircache_entries)))
dir_free(dir);
}
memcpy( data, ad_entry( &ad, ADEID_FINDERI ), 32 );
} else { /* no appledouble */
memset( data, 0, 32 );
- /* set default view -- this also gets done in ad_open() */
- ashort = htons(FINDERINFO_CLOSEDVIEW);
- memcpy(data + FINDERINFO_FRVIEWOFF, &ashort, sizeof(ashort));
-
/* dot files are by default visible */
if (invisible_dots(vol, cfrombstr(dir->d_u_name))) {
ashort = htons(FINDERINFO_INVISIBLE);
ad_flush(&ad);
ad_close(&ad, ADFLAGS_HF);
-createdir_done:
memcpy( rbuf, &dir->d_did, sizeof( uint32_t ));
*rbuflen = sizeof( uint32_t );
setvoltime(obj, vol );
err = netatalk_rmdir_all_errors(-1, cfrombstr(fdir->d_u_name));
if ( err == AFP_OK || err == AFPERR_NOOBJ) {
+ AFP_CNID_START("cnid_delete");
cnid_delete(vol->v_cdb, fdir->d_did);
+ AFP_CNID_DONE();
dir_remove( vol, fdir );
} else {
LOG(log_error, logtype_afpd, "deletecurdir(\"%s\"): netatalk_rmdir_all_errors error",