]> arthur.barton.de Git - netatalk.git/commitdiff
Fixes
authorFrank Lahm <franklahm@googlemail.com>
Sat, 21 Jan 2012 09:37:42 +0000 (10:37 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Sat, 21 Jan 2012 09:37:42 +0000 (10:37 +0100)
libatalk/adouble/ad_flush.c
libatalk/adouble/ad_open.c

index 83febd0e84a02ef204025fa19abf7ebf6d84df21..77dfd7eaff97cef1f0a9973293e31563f64668d5 100644 (file)
@@ -251,7 +251,10 @@ static int ad_flush_hf(struct adouble *ad)
             if (AD_META_OPEN(ad)) {
                 if (ad->ad_adflags & ADFLAGS_DIR) {
                     EC_NEG1_LOG( cwd = open(".", O_RDONLY) );
-                    EC_ZERO_LOG( sys_lsetxattr(".", AD_EA_META, ad->ad_data, AD_DATASZ_EA, 0) );
+                    EC_NEG1_LOG( fchdir(ad_data_fileno(ad)) );
+                    EC_ZERO_LOG( sys_fsetxattr(".", AD_EA_META, ad->ad_data, AD_DATASZ_EA, 0) );
+                    EC_NEG1_LOG( fchdir(cwd) );
+                    cwd = -1;
                 } else {
                     EC_ZERO_LOG( sys_fsetxattr(ad_data_fileno(ad), AD_EA_META, ad->ad_data, AD_DATASZ_EA, 0) );
                 }
index 261d0f36d04bde7935ff30d750b70eed184f16d5..e8034d0e817eadb6e6f21f4efddfe21e4c64655a 100644 (file)
@@ -287,7 +287,6 @@ static int new_ad_header(struct adouble *ad, const char *path, struct stat *stp,
         ad->ad_version = AD_VERSION;
     }
 
-
     memset(ad->ad_data, 0, sizeof(ad->ad_data));
 
     if (ad->ad_vers == AD_VERSION2)
@@ -319,7 +318,10 @@ static int new_ad_header(struct adouble *ad, const char *path, struct stat *stp,
         }
 
         /* make things invisible */
-        if ((ad->ad_options & ADVOL_INVDOTS) && (*path == '.')) {
+        if ((ad->ad_options & ADVOL_INVDOTS)
+            && (*path == '.')
+            && !((adflags & ADFLAGS_DIR) && (path[1] == 0))
+            ) {
             ashort = htons(ATTRBIT_INVISIBLE);
             ad_setattr(ad, ashort);
             ashort = htons(FINDERINFO_INVISIBLE);
@@ -958,8 +960,10 @@ static int ad_open_hf_ea(const char *path, int adflags, int mode, struct adouble
     if (ad->ad_ops->ad_header_read(path, ad, NULL) != 0) {
         LOG(log_error, logtype_default, "ad_open_hf_ea: no EA adouble");
 
-        if (!(adflags & ADFLAGS_CREATE))
+        if (!(adflags & ADFLAGS_CREATE)) {
+            errno = ENOENT;
             goto error;
+        }
 
         LOG(log_debug, logtype_default, "ad_open_hf_ea(\"%s\"): creating metadata EA", path);
 
@@ -1539,6 +1543,7 @@ int ad_metadataat(int dirfd, const char *name, int flags, struct adouble *adp)
     }
 
     if (dirfd != -1) {
+
         if (fchdir(cwdfd) != 0) {
             LOG(log_error, logtype_afpd, "ad_openat: cant chdir back, exiting");
             exit(EXITERR_SYS);