Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0924e9d9 authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "base: add more error-checking overloads for unique_fd." am: 946f7d44

am: 2ba6e11a

Change-Id: I59468f8523460c50495117f21b1106b16d993ddc
parents e99fb911 2ba6e11a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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")));