Merge "idle-maint: don't need to change discard_granularity"
diff --git a/Android.bp b/Android.bp
index dca801e..1045dc2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -17,6 +17,7 @@
"-*",
"cert-*",
"clang-analyzer-security*",
+ "android-*",
],
tidy_flags: [
"-warnings-as-errors=clang-analyzer-security*,cert-*",
diff --git a/AppFuseUtil.cpp b/AppFuseUtil.cpp
index ba82ba5..c491ecd 100644
--- a/AppFuseUtil.cpp
+++ b/AppFuseUtil.cpp
@@ -123,7 +123,8 @@
}
// Open device FD.
- device_fd->reset(open("/dev/fuse", O_RDWR)); // not O_CLOEXEC
+ // NOLINTNEXTLINE(android-cloexec-open): Deliberately not O_CLOEXEC
+ device_fd->reset(open("/dev/fuse", O_RDWR));
if (device_fd->get() == -1) {
PLOG(ERROR) << "Failed to open /dev/fuse";
return -1;
diff --git a/Checkpoint.cpp b/Checkpoint.cpp
index e060230..e784c91 100644
--- a/Checkpoint.cpp
+++ b/Checkpoint.cpp
@@ -291,7 +291,7 @@
int ret;
std::string size_filename = std::string("/sys/") + blk_device.substr(5) + "/bow/free";
std::string content;
- ret = android::base::ReadFileToString(kMetadataCPFile, &content);
+ ret = android::base::ReadFileToString(size_filename, &content);
if (ret) {
free_bytes = std::strtoul(content.c_str(), NULL, 10);
}
@@ -330,7 +330,7 @@
if (fstab_rec->fs_mgr_flags.checkpoint_blk) {
android::base::unique_fd fd(
TEMP_FAILURE_RETRY(open(mount_rec.mount_point.c_str(), O_RDONLY | O_CLOEXEC)));
- if (!fd) {
+ if (fd == -1) {
PLOG(ERROR) << "Failed to open mount point" << mount_rec.mount_point;
continue;
}
@@ -346,7 +346,7 @@
}
if (fstab_rec->fs_mgr_flags.checkpoint_blk || fstab_rec->fs_mgr_flags.checkpoint_fs) {
std::thread(cp_healthDaemon, std::string(mount_rec.mount_point),
- std::string(mount_rec.mount_point),
+ std::string(mount_rec.blk_device),
fstab_rec->fs_mgr_flags.checkpoint_fs == 1)
.detach();
}
@@ -575,7 +575,7 @@
Status status = Status::ok();
LOG(INFO) << action << " checkpoint on " << blockDevice;
- base::unique_fd device_fd(open(blockDevice.c_str(), O_RDWR));
+ base::unique_fd device_fd(open(blockDevice.c_str(), O_RDWR | O_CLOEXEC));
if (device_fd < 0) {
PLOG(ERROR) << "Cannot open " << blockDevice;
return Status::fromExceptionCode(errno, ("Cannot open " + blockDevice).c_str());
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 51eec8a..897c2a8 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -500,7 +500,8 @@
}
// We purposefully leave the namespace open across the fork
- nsFd = openat(pidFd, "ns/mnt", O_RDONLY); // not O_CLOEXEC
+ // NOLINTNEXTLINE(android-cloexec-open): Deliberately not O_CLOEXEC
+ nsFd = openat(pidFd, "ns/mnt", O_RDONLY);
if (nsFd < 0) {
PLOG(WARNING) << "Failed to open namespace for " << de->d_name;
goto next;
diff --git a/secdiscard.cpp b/secdiscard.cpp
index cb2eca9..0ff05d6 100644
--- a/secdiscard.cpp
+++ b/secdiscard.cpp
@@ -75,7 +75,8 @@
#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32)
#define F2FS_IOC_GET_PIN_FILE _IOR(F2FS_IOCTL_MAGIC, 14, __u32)
#endif
- android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(target.c_str(), O_WRONLY, 0)));
+ android::base::unique_fd fd(
+ TEMP_FAILURE_RETRY(open(target.c_str(), O_WRONLY | O_CLOEXEC, 0)));
if (fd == -1) {
LOG(ERROR) << "Secure discard open failed for: " << target;
return 0;