]> arthur.barton.de Git - netatalk.git/commitdiff
EAs for dirs did not work
authorfranklahm <franklahm>
Thu, 15 Oct 2009 15:35:05 +0000 (15:35 +0000)
committerfranklahm <franklahm>
Thu, 15 Oct 2009 15:35:05 +0000 (15:35 +0000)
etc/afpd/extattrs.c
libatalk/vfs/ea.c

index 429cff0029fd272ca721519a7c930c549c2c95d6..2e850e5015cc61576c00ea56dc29c42261d6a831 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: extattrs.c,v 1.6 2009-10-15 10:43:13 didg Exp $
+  $Id: extattrs.c,v 1.7 2009-10-15 15:35:05 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -74,12 +74,13 @@ static void hexdump(void *m, size_t l) {
 */
 int afp_listextattr(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
 {
-    int                 count, ret, oflag = 0;
+    int                 count, ret, oflag = 0, adflags = 0;
     uint16_t            vid, bitmap;
     uint32_t            did, maxreply, tmpattr;
     struct vol          *vol;
     struct dir          *dir;
     struct path         *s_path;
+    struct stat         st;
     struct adouble      ad, *adp = NULL;
     struct ofork        *of;
     char                *uname, *FinderInfo;
@@ -145,7 +146,11 @@ int afp_listextattr(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, siz
             adp = &ad;
         }
 
-        if ( ad_metadata( uname, 0, adp) < 0 ) {
+        stat(uname, &st);
+        if (S_ISDIR(st.st_mode))
+            adflags = ADFLAGS_DIR;
+
+        if ( ad_metadata( uname, adflags, adp) < 0 ) {
             switch (errno) {
             case EACCES:
                 LOG(log_error, logtype_afpd, "afp_listextattr(%s): %s: check resource fork permission?",
index 304c794fd835938897c675b9148cdd85e1ed44ad..e6222b98dd0099a7e99a45ae805aa813c6b3a7d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  $Id: ea.c,v 1.5 2009-10-15 15:00:55 franklahm Exp $
+  $Id: ea.c,v 1.6 2009-10-15 15:35:05 franklahm Exp $
   Copyright (c) 2009 Frank Lahm <franklahm@gmail.com>
 
   This program is free software; you can redistribute it and/or modify
@@ -591,8 +591,9 @@ static int ea_open(const struct vol * restrict vol,
     memset(ea, 0, sizeof(struct ea));
 
     ea->vol = vol;              /* ea_close needs it */
-
     ea->ea_flags = eaflags;
+    /* Dont check for errors, eg when removing the file is already gone */
+    stat(uname, &st);
     if (S_ISDIR(st.st_mode))
         ea->ea_flags |=  EA_DIR;