]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/adouble/ad_open.c
Solaris fixes
[netatalk.git] / libatalk / adouble / ad_open.c
index aeb34c29c4c5a8bdef22fcb1bf101eff5b885a4e..4b78d467359d522d16550f264e2fe179cf31b51e 100644 (file)
@@ -938,6 +938,10 @@ static int ad_open_hf_ea(const char *path, int adflags, int mode, struct adouble
 
     oflags = O_NOFOLLOW | (ad2openflags(adflags) & ~(O_CREAT | O_TRUNC));
 
+    if (ad_meta_fileno(ad) == -2)
+        /* symlink */
+        EC_EXIT;
+
     if (ad_meta_fileno(ad) != -1) {
         /* the file is already open, but we want write access: */
         if ((oflags & O_RDWR) &&
@@ -957,7 +961,7 @@ static int ad_open_hf_ea(const char *path, int adflags, int mode, struct adouble
                 /* For directories we open the directory RDONYL so we can later fchdir()  */
                 oflags = (oflags & ~O_RDWR) | O_RDONLY;
             LOG(log_debug, logtype_default, "ad_open_hf_ea(\"%s\"): opening base file for meta adouble EA", path);
-            EC_NEG1(ad_meta_fileno(ad) = open(path, oflags));
+            EC_NEG1_LOG(ad_meta_fileno(ad) = open(path, oflags));
             opened = 1;
             ad->ad_mdp->adf_flags = oflags;
         }
@@ -966,6 +970,7 @@ static int ad_open_hf_ea(const char *path, int adflags, int mode, struct adouble
     /* Read the adouble header in and parse it.*/
     if (ad->ad_ops->ad_header_read(path, ad, NULL) != 0) {
         if (!(adflags & ADFLAGS_CREATE)) {
+            LOG(log_error, logtype_default, "ad_open_hf_ea(\"%s\"): can't read metadata EA", path);
             errno = ENOENT;
             EC_FAIL;
         }
@@ -1046,7 +1051,7 @@ static int ad_reso_size(const char *path, int adflags, struct adouble *ad)
         EC_NEG1( eafd = sys_getxattrfd(path, AD_EA_RESO, O_RDONLY) );
         opened = 1;
     }
-    EC_NEG1( rlen = fstat(eafd, &st) );
+    EC_NEG1( fstat(eafd, &st) );
     ad->ad_rlen = st.st_size;
 #else
     const char *rfpath;
@@ -1109,11 +1114,11 @@ static int ad_open_rf(const char *path, int adflags, int mode, struct adouble *a
         goto EC_CLEANUP;
     }
 #ifdef HAVE_EAFD
-    if ((ad_reso_fileno(ad) = sys_getxattrfd(path, oflags)) == -1) {
+    if ((ad_reso_fileno(ad) = sys_getxattrfd(path, AD_EA_RESO, oflags)) == -1) {
         if (!(adflags & ADFLAGS_CREATE))
             EC_FAIL;
         oflags |= O_CREAT;
-        EC_NEG1_LOG( ad_reso_fileno(ad) = sys_getxattrfd(path, oflags, 0666) ); 
+        EC_NEG1_LOG( ad_reso_fileno(ad) = sys_getxattrfd(path, AD_EA_RESO, oflags, 0666) ); 
     }
 #else
     EC_NULL_LOG( rfpath = ad->ad_ops->ad_path(path, adflags) );
@@ -1595,6 +1600,7 @@ int ad_refresh(const char *path, struct adouble *ad)
             // TODO: read meta EA
         }
 
+#if 0
         if (AD_RSRC_OPEN(ad)) {
             if (ad_reso_fileno(ad) == -1)
                 return -1;
@@ -1603,6 +1609,7 @@ int ad_refresh(const char *path, struct adouble *ad)
                 return -1;
             ad->ad_rlen = len;
         }
+#endif
 #else
         if (AD_META_OPEN(ad)) {
             if (ad_data_fileno(ad) == -1)