summaryrefslogtreecommitdiffstats
path: root/otafault
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-11-18 03:02:42 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-11-18 03:02:43 +0100
commit2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64 (patch)
treeb0baa193cad940e1e172e53cd3e960c62ca22275 /otafault
parentMerge "updater: Add "write_value()" function." (diff)
parentapplypatch: Use unique_fd to avoid leaking FDs. (diff)
downloadandroid_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar.gz
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar.bz2
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar.lz
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar.xz
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.tar.zst
android_bootable_recovery-2e5cf3c0bc00114d3ac66ce62cf2fb9ab72b7e64.zip
Diffstat (limited to 'otafault')
-rw-r--r--otafault/ota_io.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/otafault/ota_io.h b/otafault/ota_io.h
index 84187a76e..e119eef08 100644
--- a/otafault/ota_io.h
+++ b/otafault/ota_io.h
@@ -26,6 +26,8 @@
#include <stdio.h>
#include <sys/stat.h>
+#include <android-base/unique_fd.h>
+
#define OTAIO_CACHE_FNAME "/cache/saved.file"
void ota_set_fault_files();
@@ -50,4 +52,12 @@ ssize_t ota_write(int fd, const void* buf, size_t nbyte);
int ota_fsync(int fd);
+struct OtaCloser {
+ static void Close(int fd) {
+ ota_close(fd);
+ }
+};
+
+using unique_fd = android::base::unique_fd_impl<OtaCloser>;
+
#endif