X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Ffile.c;h=efbc55ab05e30a4491795655569e00201fd7a496;hp=74fdc0349414c87da6a6c31c09ca43fea147635f;hb=9d78f9b52ea18b442fc91c6a1e8d8b607f2f90e8;hpb=97947cdd4ed4343ec1ae1df25f9f23d9b3f6432b diff --git a/etc/afpd/file.c b/etc/afpd/file.c index 74fdc034..efbc55ab 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -1,5 +1,5 @@ /* - * $Id: file.c,v 1.92.2.2.2.31.2.15 2005-09-27 10:40:41 didg Exp $ + * $Id: file.c,v 1.92.2.2.2.31.2.22 2008-11-25 15:16:33 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -89,7 +89,7 @@ static int default_type(void *finder) } /* FIXME path : unix or mac name ? (for now it's unix name ) */ -void *get_finderinfo(const char *upath, struct adouble *adp, void *data) +void *get_finderinfo(const struct vol *vol, const char *upath, struct adouble *adp, void *data) { struct extmap *em; void *ad_finder = NULL; @@ -107,11 +107,11 @@ void *get_finderinfo(const char *upath, struct adouble *adp, void *data) else { memcpy(data, ufinderi, ADEDLEN_FINDERI); chk_ext = 1; - if (*upath == '.') { /* make it invisible */ + if (vol_inv_dots(vol) && *upath == '.') { /* make it invisible */ u_int16_t ashort; ashort = htons(FINDERINFO_INVISIBLE); - memcpy(data + FINDERINFO_FRFLAGOFF, &ashort, sizeof(ashort)); + memcpy((char *)data + FINDERINFO_FRFLAGOFF, &ashort, sizeof(ashort)); } } /** Only enter if no appledouble information and no finder information found. */ @@ -282,7 +282,7 @@ int getmetadata(struct vol *vol, case FILPBIT_ATTR : if ( adp ) { ad_getattr(adp, &ashort); - } else if (*upath == '.') { + } else if (vol_inv_dots(vol) && *upath == '.') { ashort = htons(ATTRBIT_INVISIBLE); } else ashort = 0; @@ -336,7 +336,7 @@ int getmetadata(struct vol *vol, break; case FILPBIT_FINFO : - get_finderinfo(upath, adp, (char *)data); + get_finderinfo(vol, upath, adp, (char *)data); data += ADEDLEN_FINDERI; break; @@ -657,7 +657,7 @@ int ibuflen _U_, *rbuflen; openf = O_RDWR|O_CREAT|O_EXCL; } - if ( ad_open( upath, vol_noadouble(vol)|ADFLAGS_DF|ADFLAGS_HF|ADFLAGS_NOHF, + if ( ad_open( upath, vol_noadouble(vol)|ADFLAGS_DF|ADFLAGS_HF|ADFLAGS_NOHF|ADFLAGS_CREATE, openf, 0666, adp) < 0 ) { switch ( errno ) { case EROFS: @@ -668,6 +668,9 @@ int ibuflen _U_, *rbuflen; return( AFPERR_EXIST ); case EACCES : return( AFPERR_ACCESS ); + case EDQUOT: + case ENOSPC : + return( AFPERR_DFULL ); default : return( AFPERR_PARAM ); } @@ -1323,7 +1326,7 @@ int ibuflen _U_, *rbuflen; } /* ----------------------- */ -static __inline__ int copy_all(const int dfd, const void *buf, +static int copy_all(const int dfd, const void *buf, size_t buflen) { ssize_t cc; @@ -1451,7 +1454,7 @@ struct adouble *adp; st.st_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; } - if (ad_open(dst , adflags | noadouble, O_RDWR|O_CREAT|O_EXCL, st.st_mode, &add) < 0) { + if (ad_open(dst , adflags, O_RDWR|O_CREAT|O_EXCL, st.st_mode, &add) < 0) { ret_err = errno; ad_close( adp, adflags ); if (EEXIST != ret_err) { @@ -1474,8 +1477,10 @@ struct adouble *adp; ad_close( adp, adflags ); if (ad_close( &add, adflags ) <0) { + if (!ret_err) { + ret_err = errno; + } deletefile(d_vol, dst, 0); - ret_err = errno; goto done; }