]> arthur.barton.de Git - netatalk.git/blobdiff - libatalk/util/volinfo.c
Merge master
[netatalk.git] / libatalk / util / volinfo.c
index 6e950924120995bd961a1e36002f0f8fbb368d40..52360b1ece0330089386c5383f9cc619c74403e3 100644 (file)
@@ -485,13 +485,19 @@ int savevolinfo(const struct vol *vol, const char *Cnid_srv, const char *Cnid_po
     }
 
     if ((fd = open(item, O_RDWR | O_CREAT , 0666)) <0 ) {
-        LOG(log_error, logtype_afpd,"Error opening %s: %s", item, strerror(errno));
+        LOG(log_debug, logtype_default,"Error opening %s: %s", item, strerror(errno));
+        if (process_uid) {
+            if (seteuid(process_uid) == -1) {
+                LOG(log_error, logtype_default, "can't seteuid back %s", strerror(errno));
+                exit(EXITERR_SYS);
+            }
+        }
         return (-1);
     }
 
     if (process_uid) {
         if (seteuid(process_uid) == -1) {
-            LOG(log_error, logtype_logger, "can't seteuid back %s", strerror(errno));
+            LOG(log_error, logtype_default, "can't seteuid back %s", strerror(errno));
             exit(EXITERR_SYS);
         }
     }
@@ -507,7 +513,7 @@ int savevolinfo(const struct vol *vol, const char *Cnid_srv, const char *Cnid_po
             /* ignore, other process already writing the file */
             return 0;
         } else {
-            LOG(log_error, logtype_cnid, "savevoloptions: cannot get lock: %s", strerror(errno));
+            LOG(log_error, logtype_default, "savevoloptions: cannot get lock: %s", strerror(errno));
             return (-1);
         }
     }
@@ -587,9 +593,9 @@ int savevolinfo(const struct vol *vol, const char *Cnid_srv, const char *Cnid_po
     strlcat(buf, item, sizeof(buf));
 
     if (strlen(buf) >= sizeof(buf)-1)
-        LOG(log_debug, logtype_afpd,"Error writing .volinfo file: buffer too small, %s", buf);
+        LOG(log_debug, logtype_default, "Error writing .volinfo file: buffer too small, %s", buf);
    if (write( fd, buf, strlen(buf)) < 0 || ftruncate(fd, strlen(buf)) < 0 ) {
-       LOG(log_debug, logtype_afpd,"Error writing .volinfo file: %s", strerror(errno));
+       LOG(log_debug, logtype_default, "Error writing .volinfo file: %s", strerror(errno));
    }
 
    lock.l_type = F_UNLCK;