Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1f198d9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Chmod for existing nodes which mode not the same as ueventd.rc" am:...

Merge "Chmod for existing nodes which mode not the same as ueventd.rc" am: a50d4318 am: 79c6750b am: 42ffffd8

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2063313



Change-Id: I94cb8fcef3fadd351c1c4ce8eb43ac9cc7f1cacd
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 73185ff5 42ffffd8
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -307,8 +307,8 @@ void DeviceHandler::MakeDevice(const std::string& path, bool block, int major, i
        PLOG(ERROR) << "setegid(" << gid << ") for " << path << " device failed";
        PLOG(ERROR) << "setegid(" << gid << ") for " << path << " device failed";
        goto out;
        goto out;
    }
    }
    /* If the node already exists update its SELinux label to handle cases when
    /* If the node already exists update its SELinux label and the file mode to handle cases when
     * it was created with the wrong context during coldboot procedure. */
     * it was created with the wrong context and file mode during coldboot procedure. */
    if (mknod(path.c_str(), mode, dev) && (errno == EEXIST) && !secontext.empty()) {
    if (mknod(path.c_str(), mode, dev) && (errno == EEXIST) && !secontext.empty()) {
        char* fcon = nullptr;
        char* fcon = nullptr;
        int rc = lgetfilecon(path.c_str(), &fcon);
        int rc = lgetfilecon(path.c_str(), &fcon);
@@ -330,6 +330,11 @@ void DeviceHandler::MakeDevice(const std::string& path, bool block, int major, i
            if (gid != s.st_gid) {
            if (gid != s.st_gid) {
                new_group = gid;
                new_group = gid;
            }
            }
        if (mode != s.st_mode) {
            if (chmod(path.c_str(), mode) != 0) {
                PLOG(ERROR) << "Cannot chmod " << path << " to " << mode;
            }
        }
        } else {
        } else {
            PLOG(ERROR) << "Cannot stat " << path;
            PLOG(ERROR) << "Cannot stat " << path;
        }
        }