]> arthur.barton.de Git - netatalk.git/commitdiff
Solaris fixes for bugs #501 and #502
authorRalph Boehme <sloowfranklin@gmail.com>
Sat, 9 Mar 2013 12:50:37 +0000 (13:50 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Sat, 9 Mar 2013 12:50:37 +0000 (13:50 +0100)
libatalk/adouble/ad_open.c
libatalk/vfs/extattr.c

index 3b641d66ef0eb9355a9365131431649a25a9836e..cd45fef2e20ddf9c526b08a07f7c2a6f9c8a5717 100644 (file)
@@ -1247,12 +1247,32 @@ static int ad_open_rf_ea(const char *path, int adflags, int mode, struct adouble
         EC_FAIL;
     if ((ad_reso_fileno(ad) = sys_getxattrfd(ad_meta_fileno(ad), AD_EA_RESO, oflags)) == -1) {
         if (!(adflags & ADFLAGS_CREATE)) {
-            errno = ENOENT;
-            EC_FAIL;
+            switch (errno) {
+            case EACCES:
+            case EPERM:
+            case EROFS:
+                if (!(adflags & ADFLAGS_RDONLY)) {
+                    LOG(log_error, logtype_ad, "ad_open_rf_ea(\"%s\"): \"%s\"", fullpathname(path), strerror(errno));
+                    EC_FAIL;
+                }
+                oflags &= ~O_RDWR;
+                oflags |= O_RDONLY;
+                if ((ad_reso_fileno(ad) = sys_getxattrfd(ad_meta_fileno(ad), AD_EA_RESO, oflags)) == -1) {
+                    LOG(log_error, logtype_ad, "ad_open_rf_ea(\"%s\"): \"%s\"", fullpathname(path), strerror(errno));
+                    EC_FAIL;
+                }
+                break;
+            case ENOENT:
+                EC_EXIT_STATUS(0);
+            default:
+                LOG(log_error, logtype_ad, "ad_open_rf_ea(\"%s\"): \"%s\"", fullpathname(path), strerror(errno));
+                EC_FAIL;
+            }
+        } else {
+            oflags |= O_CREAT;
+            EC_NEG1_LOG( ad_reso_fileno(ad) = sys_getxattrfd(ad_meta_fileno(ad),
+                                                             AD_EA_RESO, oflags, 0666) );
         }
-        oflags |= O_CREAT;
-        EC_NEG1_LOG( ad_reso_fileno(ad) = sys_getxattrfd(ad_meta_fileno(ad),
-                                                         AD_EA_RESO, oflags, 0666) ); 
     }
 #else
     EC_NULL_LOG( rfpath = ad->ad_ops->ad_path(path, adflags) );
index 5206aa6d69d16698f62f8c2d9fd4c2c770ab7bf3..73724d53080d66908ae3c07fa9166f58c10bd45e 100644 (file)
@@ -910,6 +910,7 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode)
         switch (errno) {
         case ENOENT:
         case EEXIST:
+        case EACCES:
             break;
         default:
             LOG(log_debug, logtype_default, "openat(\"%s\"): %s",