Browse Source

Merge pull request #407 from misuzu/chownfix

Chown fix
Adam Ierymenko 9 năm trước cách đây
mục cha
commit
d773ab2806
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      osdep/LinuxDropPrivileges.cpp

+ 2 - 2
osdep/LinuxDropPrivileges.cpp

@@ -102,6 +102,8 @@ void dropPrivileges(std::string homeDir) {
         return;
     }
 
+    createOwnedHomedir(homeDir, targetUser);
+
     if (prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET, CAP_NET_RAW, 0, 0) < 0) {
         // Kernel has no support for ambient capabilities.
         notDropping(homeDir);
@@ -113,8 +115,6 @@ void dropPrivileges(std::string homeDir) {
         return;
     }
 
-    createOwnedHomedir(homeDir, targetUser);
-
     if (setCapabilities((1 << CAP_NET_ADMIN) | (1 << CAP_NET_RAW) | (1 << CAP_SETUID) | (1 << CAP_SETGID)) < 0) {
         fprintf(stderr, "ERROR: failed to set capabilities (not running as real root?)\n");
         exit(1);