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

Commit 6d3c0ef0 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge changes from topic "snapshotctl_log" am: da8a4044

Change-Id: I4ebac8b522159ed3183ee6f5caeba38fd662f43e
parents 066cfa37 da8a4044
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -232,7 +232,12 @@ bool SnapshotManager::RemoveAllUpdateState(LockedFile* lock) {
    LOG(WARNING) << callstack_str.c_str();
    std::stringstream path;
    path << "/data/misc/snapshotctl_log/libsnapshot." << Now() << ".log";
    android::base::WriteStringToFile(callstack_str.c_str(), path.str());
    std::string path_str = path.str();
    android::base::WriteStringToFile(callstack_str.c_str(), path_str);
    if (chmod(path_str.c_str(), 0644) == -1) {
        PLOG(WARNING) << "Unable to chmod 0644 "
                      << ", file maybe dropped from bugreport:" << path_str;
    }
#endif

    if (!RemoveAllSnapshots(lock)) {
+12 −2
Original line number Diff line number Diff line
@@ -61,7 +61,16 @@ class FileLogger {
        ss << kLogFilePath << "snapshotctl." << Now() << ".log";
        fd_.reset(TEMP_FAILURE_RETRY(
                open(ss.str().c_str(),
                     O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_SYNC, 0660)));
                     O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_SYNC, 0644)));
        if (fd_ == -1) {
            PLOG(ERROR) << "Cannot open persistent log " << ss.str();
            return;
        }
        // Explicitly chmod again because mode in open() may be masked by umask.
        if (fchmod(fd_.get(), 0644) == -1) {
            PLOG(ERROR) << "Cannot chmod 0644 persistent log " << ss.str();
            return;
        }
    }
    // Copy-contuctor needed to be converted to std::function.
    FileLogger(const FileLogger& other) { fd_.reset(dup(other.fd_)); }
@@ -108,7 +117,8 @@ bool MergeCmdHandler(int argc, char** argv) {

    // 'snapshotctl merge' is stripped away from arguments to
    // Logger.
    android::base::InitLogging(argv, MergeCmdLogger(argc - 2, argv + 2));
    android::base::InitLogging(argv);
    android::base::SetLogger(MergeCmdLogger(argc - 2, argv + 2));

    auto state = SnapshotManager::New()->InitiateMergeAndWait();

+1 −1
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ on post-fs-data
    mkdir /data/misc/installd 0700 root root
    mkdir /data/misc/apexdata 0711 root root
    mkdir /data/misc/apexrollback 0700 root root
    mkdir /data/misc/snapshotctl_log 0770 root root
    mkdir /data/misc/snapshotctl_log 0755 root root
    # create location to store pre-reboot information
    mkdir /data/misc/prereboot 0700 system system