libsnapshot callstack files readable by dumpstate
Set callstack logs as 0644 so that they are readable
by dumpstate.
Test: take OTA, cancel, delete /data/misc/update_engine/prefs/*
manually, retrigger OTA (so that callstack is logged), then re-take bug report
Bug: 148818798
Change-Id: I598e484b57dcd3ce6ed7bb483aee57ce2ba881e7
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index a937b43..ba53615 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -232,7 +232,12 @@
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)) {