Merge changes from topic "snapshotctl_log"
* changes: libsnapshot callstack files readable by dumpstate snapshotctl logs readable by dumpstate snapshotctl_log dir readable by dumpstate
This commit is contained in:
commit
da8a404473
|
@ -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)) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue