X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Ffiledir.c;h=5f6e0f643e5987f101a2068123772eb8a50a21f8;hb=4054f4b3c85ecab060dafd46c0d3632cadbb5803;hp=d3976119444440fbc07a8422b4c4c12c57bf043b;hpb=5116ed2346ea7ee6e5a9858dee94f3eacdc00d7e;p=netatalk.git diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index d3976119..5f6e0f64 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -40,6 +40,7 @@ char *strchr (), *strrchr (); #include #include #include +#include #include "directory.h" #include "dircache.h" @@ -50,7 +51,6 @@ char *strchr (), *strrchr (); #include "globals.h" #include "filedir.h" #include "unix.h" -#include "fce_api.h" #ifdef DROPKLUDGE int matchfile2dirperms( @@ -602,16 +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 { - /* we have to cache this, the structs are lost in deletcurdir*/ - /* but we need the positive returncode to send our event */ - char dname[256]; - strncpy(dname, curdir->d_u_name, 255 ); - if ((rc = deletecurdir(vol)) == AFP_OK) - fce_register_delete_dir(dname); - } + } 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 { @@ -622,7 +624,7 @@ 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 { - if ((rc = deletefile(vol, -1, upath, 1)) === AFP_OK) + if ((rc = deletefile(vol, -1, upath, 1)) == AFP_OK) fce_register_delete_file( s_path ); struct dir *cachedfile;