]> arthur.barton.de Git - netatalk.git/commitdiff
Perform complete automatic adouble:v2 to adouble:ea conversion as root
authorFrank Lahm <franklahm@googlemail.com>
Sat, 31 Mar 2012 13:43:47 +0000 (15:43 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Sat, 31 Mar 2012 13:43:47 +0000 (15:43 +0200)
NEWS
libatalk/adouble/ad_conv.c

diff --git a/NEWS b/NEWS
index eb1d743e793f7487e2f4a9ae0e465100f0ee75aa..98dd864935366238ca32a76770469039022440df 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Changes in 3.0 alpha2
 * UPD: afdp: Automatic name conversion, renaming files and directories
        containing CAP sequences to their not enscaped forms
 * UPD: afpd: Correct handling of user homes and users without homes
+* UPD: afpd: Perform complete automatic adouble:v2 to adouble:ea conversion
+       as root. Previously only unlinking the adouble:v2 file was done as root
 * UPD: dbd: -C option removes CAP encoding
 * UPD: Add graceful option to RedHat init script
 * UPD: Add --disable-bundled-libevent configure options When set to yes,
index 10284dbbbb551faecc8e45da6f0a0885b7c53e24..eaac8db97032eab7aead8b644de35657854ea9f3 100644 (file)
@@ -103,7 +103,9 @@ static int ad_conv_v22ea_hf(const char *path, const struct stat *sp, const struc
 copy:
     /* Create a adouble:ea meta EA */
     LOG(log_debug, logtype_default,"ad_conv_v22ea_hf(\"%s\"): copying adouble", fullpathname(path), ret);
-    EC_ZERO_LOG( ad_open(&adea, path, adflags | ADFLAGS_HF | ADFLAGS_RDWR | ADFLAGS_CREATE) );
+    EC_ZERO_LOGSTR( ad_open(&adea, path, adflags | ADFLAGS_HF | ADFLAGS_RDWR | ADFLAGS_CREATE),
+                    "ad_conv_v22ea_hf(\"%s\"): error creating metadata EA: %s",
+                    fullpathname(path), strerror(errno));
     EC_ZERO_LOG( ad_copy_header(&adea, &adv2) );
     ad_flush(&adea);
 
@@ -155,6 +157,8 @@ static int ad_conv_v22ea(const char *path, const struct stat *sp, const struct v
     const char *adpath;
     int adflags = S_ISDIR(sp->st_mode) ? ADFLAGS_DIR : 0;
 
+    become_root();
+
     EC_ZERO( ad_conv_v22ea_hf(path, sp, vol) );
     EC_ZERO( ad_conv_v22ea_rf(path, sp, vol) );
 
@@ -162,13 +166,14 @@ static int ad_conv_v22ea(const char *path, const struct stat *sp, const struct v
     LOG(log_debug, logtype_default,"ad_conv_v22ea_hf(\"%s\"): deleting adouble:v2 file: \"%s\"",
         path, fullpathname(adpath));
 
-    become_root();
-    EC_ZERO_LOG( unlink(adpath) );
-    unbecome_root();
+    unlink(adpath);
 
 EC_CLEANUP:
     if (errno == ENOENT)
         EC_STATUS(0);
+
+    unbecome_root();
+
     EC_EXIT;
 }