X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=etc%2Fafpd%2Ffiledir.c;h=7166c125d36c8af3cae56270fec3924a8e31037e;hb=1f995330836cf20b5db3e5b6076735a2a0f4e81e;hp=356d82104cdadb69d910b651b92ff13632eab369;hpb=d3fdfefd086be69127da2320f2c83d8b69819fd7;p=netatalk.git diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index 356d8210..7166c125 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -41,6 +41,7 @@ char *strchr (), *strrchr (); #include #include #include +#include #include "directory.h" #include "dircache.h" @@ -601,10 +602,18 @@ int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size upath = s_path->u_name; if ( path_isadir( s_path) ) { - if (*s_path->m_name != '\0' || curdir->d_did == DIRDID_ROOT) + if (*s_path->m_name != '\0' || curdir->d_did == DIRDID_ROOT) { rc = AFPERR_ACCESS; - else - rc = deletecurdir( vol); + } else { + /* we have to cache this, the structs are lost in deletcurdir*/ + /* but we need the positive returncode to send our event */ + bstring dname; + if ((dname = bstrcpy(curdir->d_u_name)) == NULL) + return AFPERR_MISC; + if ((rc = deletecurdir(vol)) == AFP_OK) + fce_register_delete_dir(cfrombstr(dname)); + bdestroy(dname); + } } else if (of_findname(s_path)) { rc = AFPERR_BUSY; } else { @@ -614,9 +623,9 @@ int afp_delete(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size */ if (s_path->st_valid && s_path->st_errno == ENOENT) { rc = AFPERR_NOOBJ; - } - else { - rc = deletefile(vol, -1, upath, 1); + } else { + if ((rc = deletefile(vol, -1, upath, 1)) == AFP_OK) + fce_register_delete_file( s_path ); struct dir *cachedfile; if ((cachedfile = dircache_search_by_name(vol, dir, upath, strlen(upath)))) {