/* conversions on the fly */
const char *convname;
- if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0 && convname) {
- s_path.u_name = (char *)convname;
- }
-
- /* Fixup CNID db if ad_convert resulted in a rename (then convname != NULL) */
- if (convname) {
- s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));
- if (s_path.id != CNID_INVALID) {
- if (cnid_update(vol->v_cdb, s_path.id, &s_path.st, curdir->d_did, (char *)convname, strlen(convname)) != 0)
- LOG(log_error, logtype_afpd, "enumerate: error updating CNID of \"%s\"", fullpathname(convname));
+ if (ad_convert(sd.sd_last, &s_path.st, vol, &convname) == 0) {
+ if (convname) {
+ s_path.u_name = (char *)convname;
+ s_path.id = cnid_lookup(vol->v_cdb, &s_path.st, curdir->d_did, sd.sd_last, strlen(sd.sd_last));
+ if (s_path.id != CNID_INVALID) {
+ if (cnid_update(vol->v_cdb, s_path.id, &s_path.st, curdir->d_did, (char *)convname, strlen(convname)) != 0)
+ LOG(log_error, logtype_afpd, "enumerate: error updating CNID of \"%s\"", fullpathname(convname));
+ }
}
}
{
EC_INIT;
static char buf[MAXPATHLEN];
- const char *p;
int adflags = S_ISDIR(sp->st_mode) ? ADFLAGS_DIR : 0;
bstring newpath = NULL;
+ static bstring str2e = NULL;
+ static bstring str2f = NULL;
+ static bstring strdot = NULL;
+ static bstring strcolon = NULL;
+
+ if (str2e == NULL) {
+ str2e = bfromcstr(":2e");
+ str2f = bfromcstr(":2f");
+ strdot = bfromcstr(".");
+ strcolon = bfromcstr(":");
+ }
LOG(log_debug, logtype_ad,"ad_conv_dehex(\"%s\"): BEGIN", fullpathname(path));
*newpathp = NULL;
- if ((p = strchr(path, ':')) == NULL)
+ if (((strstr(path, ":2e")) == NULL) && ((strstr(path, ":2f")) == NULL) )
goto EC_CLEANUP;
EC_NULL( newpath = bfromcstr(path) );
- EC_ZERO( bfindreplace(newpath, bfromcstr(":2e"), bfromcstr("."), 0) );
- EC_ZERO( bfindreplace(newpath, bfromcstr(":2f"), bfromcstr(":"), 0) );
+ EC_ZERO( bfindreplace(newpath, str2e, strdot, 0) );
+ EC_ZERO( bfindreplace(newpath, str2f, strcolon, 0) );
become_root();
if (adflags != ADFLAGS_DIR)