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

Commit ac087d79 authored by Glenn Kasten's avatar Glenn Kasten Committed by android-build-merger
Browse files

Traverse /etc/init in a well-defined order

am: 89579f24

Change-Id: I7d56236bb85e6c0a27f7c3f304eb8bd04576e3ef
parents c4b38b2b 89579f24
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -122,14 +122,20 @@ bool Parser::ParseConfigDir(const std::string& path) {
        return false;
    }
    dirent* current_file;
    std::vector<std::string> files;
    while ((current_file = readdir(config_dir.get()))) {
        std::string current_path =
            android::base::StringPrintf("%s/%s", path.c_str(), current_file->d_name);
        // Ignore directories and only process regular files.
        if (current_file->d_type == DT_REG) {
            if (!ParseConfigFile(current_path)) {
                ERROR("could not import file '%s'\n", current_path.c_str());
            std::string current_path =
                android::base::StringPrintf("%s/%s", path.c_str(), current_file->d_name);
            files.emplace_back(current_path);
        }
    }
    // Sort first so we load files in a consistent order (bug 31996208)
    std::sort(files.begin(), files.end());
    for (const auto& file : files) {
        if (!ParseConfigFile(file)) {
            ERROR("Could not import file '%s'\n", file.c_str());
        }
    }
    return true;