]> arthur.barton.de Git - netatalk.git/blobdiff - bin/ad/ad_cp.c
Merge master
[netatalk.git] / bin / ad / ad_cp.c
index 1e4bde06290f260b488b0d26c77dfacf94ff6d0d..b0723b021976d69f4a778fdbeef3006d4c3489ea 100644 (file)
@@ -387,6 +387,10 @@ static int copy(const char *path,
     if (alarmed)
         return -1;
 
+    /* This currently doesn't work with "." */
+    if (strcmp(path, ".") == 0) {
+        ERROR("\".\" not supported");
+    }
     const char *dir = strrchr(path, '/');
     if (dir == NULL)
         dir = path;
@@ -535,12 +539,12 @@ static int copy(const char *path,
 
             struct adouble ad;
             struct stat st;
-            if (stat(to.p_path, &st) != 0) {
+            if (lstat(to.p_path, &st) != 0) {
                 badcp = rval = 1;
                 break;
             }
             ad_init(&ad, dvolume.volinfo.v_adouble, dvolume.volinfo.v_ad_options);
-            if (ad_open_metadata(to.p_path, ADFLAGS_DIR, O_RDWR | O_CREAT, &ad) != 0) {
+            if (ad_open(&ad, to.p_path, ADFLAGS_HF | ADFLAGS_DIR, O_RDWR | O_CREAT, 0666) != 0) {
                 ERROR("Error opening adouble for: %s", to.p_path);
             }
             ad_setid( &ad, st.st_dev, st.st_ino, did, pdid, dvolume.db_stamp);
@@ -602,12 +606,12 @@ static int copy(const char *path,
 
             struct adouble ad;
             struct stat st;
-            if (stat(to.p_path, &st) != 0) {
+            if (lstat(to.p_path, &st) != 0) {
                 badcp = rval = 1;
                 break;
             }
             ad_init(&ad, dvolume.volinfo.v_adouble, dvolume.volinfo.v_ad_options);
-            if (ad_open_metadata(to.p_path, 0, O_RDWR | O_CREAT, &ad) != 0) {
+            if (ad_open(&ad, to.p_path, ADFLAGS_HF, O_RDWR | O_CREAT) != 0) {
                 ERROR("Error opening adouble for: %s", to.p_path);
             }
             ad_setid( &ad, st.st_dev, st.st_ino, cnid, did, dvolume.db_stamp);