{
static char temp[ MAXPATHLEN + 1];
char *t;
- cnid_t fileid;
+ cnid_t fileid = 0;
if (afp_version >= 30) {
if (toUTF8) {
sd.sd_last = sd.sd_buf;
/* if dir was in the cache we don't have the inode */
if (( !o_path->st_valid && lstat( ".", &o_path->st ) < 0 ) ||
- (ret = for_each_dirent(vol, ".", enumerate_loop, (void *)&sd)) < 0)
+ (ret = for_each_dirent(vol, ".", enumerate_loop, (void *)&sd)) < 0)
{
+ LOG(log_error, logtype_afpd, "enumerate: loop error: %s (%d)", strerror(errno), errno);
switch (errno) {
case EACCES:
- return AFPERR_ACCESS;
+ return AFPERR_ACCESS;
case ENOTDIR:
return AFPERR_BADTYPE;
case ENOMEM:
struct stat *st;
struct maccess ma;
+ LOG(log_debug, logtype_afpd, "getmetadata(\"%s\")", path->u_name);
+
upath = path->u_name;
st = &path->st;
data = buf;
int opened = 0;
int rc;
+ LOG(log_debug, logtype_afpd, "getfilparams(\"%s\")", path->u_name);
+
opened = PARAM_NEED_ADP(bitmap);
adp = NULL;
path = s_path->m_name;
ad_setname(adp, path);
+
+ struct stat st;
+ if (lstat(upath, &st) != 0) {
+ LOG(log_error, logtype_afpd, "afp_createfile(\"%s\"): stat: %s",
+ upath, strerror(errno));
+ ad_close( adp, ADFLAGS_DF|ADFLAGS_HF);
+ return AFPERR_MISC;
+ }
+
+ (void)get_id(vol, adp, &st, dir->d_did, upath, strlen(upath));
+
ad_flush( adp);
ad_close( adp, ADFLAGS_DF|ADFLAGS_HF );
if (!isdir) {
if ((oldunixname = strdup(mtoupath(vol, oldname, sdir->d_did, utf8_encoding()))) == NULL)
return AFPERR_PARAM; /* can't convert */
+ id = cnid_get(vol->v_cdb, sdir->d_did, oldunixname, strlen(oldunixname));
#ifndef HAVE_ATFUNCS
/* Need full path */
- id = cnid_get(vol->v_cdb, sdir->d_did, p, strlen(p));
- p = ctoupath( vol, sdir, oldname );
- if (!p)
+ free(oldunixname);
+ if ((oldunixname = strdup(ctoupath(vol, sdir, oldname))) == NULL)
return AFPERR_PARAM; /* pathname too long */
#endif /* HAVE_ATFUNCS */
path.st_valid = 0;
path.u_name = oldunixname;
+
#ifdef HAVE_ATFUNCS
opened = of_findnameat(sdir_fd, &path);
#else
opened = of_findname(&path);
#endif /* HAVE_ATFUNCS */
+
if (opened) {
/* reuse struct adouble so it won't break locks */
adp = opened->of_ad;
adflags = ADFLAGS_DIR;
}
- LOG(log_debug, logtype_afpd, "oldunixname: \"%s\"", oldunixname);
-
/*
* oldunixname now points to either
* a) full pathname of the source fs object (if renameat is not available)
goto exit;
}
- LOG(log_debug, logtype_afpd, "oldunixname: \"%s\"", oldunixname);
-
if ( !isdir ) {
path.st_valid = 1;
path.st_errno = errno;