(1 << DIRPBIT_FINFO)))) {
ad_init(&ad, vol->v_adouble, vol->v_ad_options);
- if ( !ad_metadata( upath, ADFLAGS_CREATE|ADFLAGS_DIR, &ad) ) {
+ if ( !ad_metadata( upath, ADFLAGS_DIR, &ad) )
isad = 1;
- if (ad.ad_md->adf_flags & O_CREAT) {
- /* We just created it */
- ad_setname(&ad, s_path->m_name);
- ad_setid( &ad,
- s_path->st.st_dev,
- s_path->st.st_ino,
- dir->d_did,
- dir->d_pdid,
- vol->v_stamp);
- ad_flush( &ad);
- }
- }
}
pdid = dir->d_pdid;
adp = of_ad(vol, path, &ad);
upath = path->u_name;
- if ( ad_metadata( upath, flags|ADFLAGS_CREATE, adp) < 0 ) {
+ if ( ad_metadata( upath, flags, adp) < 0 ) {
switch (errno) {
case EACCES:
LOG(log_error, logtype_afpd, "getfilparams(%s): %s: check resource fork permission?",
#define ADFLAGS_NOHF (1<<4) /* not an error if no ressource fork */
#define ADFLAGS_RDONLY (1<<5) /* don't try readwrite */
#define ADFLAGS_OPENFORKS (1<<6) /* check for open fork in ad_metadata function */
-#define ADFLAGS_CREATE (1<<7)
#define ADVOL_NODEV (1 << 0)
#define ADVOL_CACHE (1 << 1)
* @brief open metadata, possibly as root
*
* Return only metadata but try very hard ie at first try as user, then try as root.
+ * Caller must pass ADFLAGS_DIR for directories.
*
* @param name name of file/dir
* @param flags ADFLAGS_DIR: name is a directory \n
- * ADFLAGS_CREATE: force creation of header file, but only as user, not as root\n
* ADFLAGS_OPENFORKS: test if name is open by another afpd process
*
* @param adp pointer to struct adouble
- *
- * @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)
{
dir = flags & ADFLAGS_DIR;
- /* 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 | O_RDWR;
- }
if ((ret = ad_open(name, ADFLAGS_HF | dir, create, 0666, adp)) < 0 && errno == EACCES) {
uid = geteuid();
if (seteuid(0)) {