diff options
| author | Josh Gao <jmgao@google.com> | 2018-12-03 22:41:22 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-12-03 22:41:22 +0000 |
| commit | 946f7d44c2df177227b7e90cb61ac1be12145e86 (patch) | |
| tree | 062bdc686850fb4f68796087d5dc4f3572ff08f4 /base | |
| parent | 307337fb40539fc2ab6bb3384ec3b679e36b78b2 (diff) | |
| parent | 1390e81d1c09f0e8c8c67b0ad5a425f8dda051f7 (diff) | |
| download | system_core-946f7d44c2df177227b7e90cb61ac1be12145e86.tar.gz system_core-946f7d44c2df177227b7e90cb61ac1be12145e86.tar.bz2 system_core-946f7d44c2df177227b7e90cb61ac1be12145e86.zip | |
Merge "base: add more error-checking overloads for unique_fd."
Diffstat (limited to 'base')
| -rw-r--r-- | base/include/android-base/unique_fd.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h index 4e3879b99..4e6c87982 100644 --- a/base/include/android-base/unique_fd.h +++ b/base/include/android-base/unique_fd.h @@ -16,6 +16,7 @@ #pragma once +#include <dirent.h> #include <fcntl.h> #if !defined(_WIN32) @@ -231,3 +232,13 @@ inline DIR* Fdopendir(unique_fd&& ufd) { template <typename T> int close(const android::base::unique_fd_impl<T>&) __attribute__((__unavailable__("close called on unique_fd"))); + +template <typename T> +FILE* fdopen(const android::base::unique_fd_impl<T>&, const char* mode) + __attribute__((__unavailable__("fdopen takes ownership of the fd passed in; either dup the " + "unique_fd, or use android::base::Fdopen to pass ownership"))); + +template <typename T> +DIR* fdopendir(const android::base::unique_fd_impl<T>&) __attribute__(( + __unavailable__("fdopendir takes ownership of the fd passed in; either dup the " + "unique_fd, or use android::base::Fdopendir to pass ownership"))); |
