From: jmarcus Date: Tue, 5 Mar 2002 02:04:46 +0000 (+0000) Subject: Fix a problem where afp_deleteid() would delete the parent directory, X-Git-Tag: point-backport-1-5-2~6 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=91fad6bd493f0cdd0726f697d5ef64f3df90d075 Fix a problem where afp_deleteid() would delete the parent directory, and not the specified file id. Submitted by: didier MFH after: 3 days --- diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 494bae01..0f3280fe 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1,5 +1,5 @@ /* - * $Id: file.c,v 1.39 2002-02-02 19:11:33 jmarcus Exp $ + * $Id: file.c,v 1.40 2002-03-05 02:04:46 jmarcus Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -1474,6 +1474,7 @@ int ibuflen, *rbuflen; char *upath; int err; cnid_t id; + cnid_t fileid; u_short vid; #ifdef DEBUG @@ -1495,7 +1496,8 @@ int ibuflen, *rbuflen; memcpy(&id, ibuf, sizeof( id )); ibuf += sizeof(id); - + fileid = id; + if ((upath = cnid_resolve(vol->v_db, &id)) == NULL) { return AFPERR_NOID; } @@ -1523,7 +1525,7 @@ int ibuflen, *rbuflen; if (S_ISDIR(st.st_mode)) return AFPERR_BADTYPE; - if (cnid_delete(vol->v_db, id)) { + if (cnid_delete(vol->v_db, fileid)) { switch (errno) { case EROFS: return AFPERR_VLOCK;