/*
- $Id: extattrs.c,v 1.15 2009-10-28 01:52:49 didg Exp $
+ $Id: extattrs.c,v 1.17 2009-10-29 10:27:45 didg Exp $
Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
This program is free software; you can redistribute it and/or modify
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <atalk/adouble.h>
#include <atalk/vfs.h>
struct vol *vol;
struct dir *dir;
struct path *s_path;
- struct stat st;
+ struct stat *st;
struct adouble ad, *adp = NULL;
struct ofork *of;
char *uname, *FinderInfo;
LOG(log_error, logtype_afpd, "afp_listextattr: cname error: %s", strerror(errno));
return AFPERR_NOOBJ;
}
- uname = s_path->u_name;
- /*
+ st = &s_path->st;
+ if (!s_path->st_valid) {
+ /* it's a dir in our cache, we didn't stat it, do it now */
+ of_statdir(vol, s_path);
+ }
+ if ( s_path->st_errno != 0 ) {
+ return( AFPERR_NOOBJ );
+ }
+
+ uname = s_path->u_name; /*
We have to check the FinderInfo for the file, because if they aren't all 0
we must return the synthetic attribute "com.apple.FinderInfo".
Note: the client will never (never seen in traces) request that attribute
adp = &ad;
}
- stat(uname, &st);
- if (S_ISDIR(st.st_mode))
+ if (S_ISDIR(st->st_mode))
adflags = ADFLAGS_DIR;
if ( ad_metadata( uname, adflags, adp) < 0 ) {