X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libatalk%2Fadouble%2Fad_open.c;h=b0eb42350553b2924d2e42e9cbc31a1abcf26691;hb=6f3a5b930085e56f39b415f20db02df98dbecfff;hp=5531091a7db6094dbcaa30b31945dc26edf0f587;hpb=461587c2cfea98f334cf6575dbaeefe43eb41eba;p=netatalk.git diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index 5531091a..b0eb4235 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -1,5 +1,5 @@ /* - * $Id: ad_open.c,v 1.66 2010-01-06 11:08:53 franklahm Exp $ + * $Id: ad_open.c,v 1.68 2010-01-06 14:05:15 franklahm Exp $ * * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) * Copyright (c) 1990,1991 Regents of The University of Michigan. @@ -1515,15 +1515,22 @@ sfm: * ADFLAGS_CREATE: force creation of header file, but only as use, not as root * @param adp pointer to struct adouble * - * @note caller MUST pass ADFLAGS_DIR for directories + * @note caller MUST pass ADFLAGS_DIR for directories. Whether ADFLAGS_CREATE really creates + * a adouble file depends on various other volume options, eg. ADVOL_CACHE */ int ad_metadata(const char *name, int flags, struct adouble *adp) { uid_t uid; - int ret, err, dir, create; + int ret, err, dir; + int create = 0; dir = flags & ADFLAGS_DIR; - create = (flags & ADFLAGS_CREATE) ? O_CREAT : 0; + + /* Check if we shall call ad_open with O_CREAT */ + if ( (adp->ad_options & ADVOL_CACHE) + && ! (adp->ad_options & ADVOL_NOADOUBLE) + && (flags & ADFLAGS_CREATE) ) + create = O_CREAT; if ((ret = ad_open(name, ADFLAGS_HF | dir, O_RDWR | create, 0666, adp)) < 0 && errno == EACCES) { uid = geteuid();