summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-08-31 20:47:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-08-31 20:47:13 +0000
commitca82aa7d1ea42b98a2b0f9e60e440ea23621eca4 (patch)
tree7e138d8ab94023a9b94bfcfb7b3aa6f73f91474b /base
parent6a5ed849e832aac7da24fca5b7cf01d7c052f56e (diff)
parent6496c4bf6f31bd0714a341d51c1cff7f15938e84 (diff)
downloadcore-ca82aa7d1ea42b98a2b0f9e60e440ea23621eca4.tar.gz
core-ca82aa7d1ea42b98a2b0f9e60e440ea23621eca4.tar.bz2
core-ca82aa7d1ea42b98a2b0f9e60e440ea23621eca4.zip
Merge "base: disallow close() on unique_fd."
Diffstat (limited to 'base')
-rw-r--r--base/include/android-base/unique_fd.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h
index 869e60f58..c32331180 100644
--- a/base/include/android-base/unique_fd.h
+++ b/base/include/android-base/unique_fd.h
@@ -95,4 +95,14 @@ using unique_fd = unique_fd_impl<DefaultCloser>;
} // namespace base
} // namespace android
+template <typename T>
+int close(const android::base::unique_fd_impl<T>&)
+#if defined(__clang__)
+ __attribute__((__unavailable__(
+#else
+ __attribute__((__error__(
+#endif
+ "close called on unique_fd"
+ )));
+
#endif // ANDROID_BASE_UNIQUE_FD_H