From d8e667a638401df1bf881b16fcda6315f3fa3eb1 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Tue, 11 Sep 2018 22:45:16 -0500 Subject: unistd: Add __open_2 and its __open64_2 alias Signed-off-by: Samuel Holland --- CHANGELOG.rst | 5 +++++ libgcompat/unistd.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f97724f..edc96f5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -68,6 +68,11 @@ string * Add memfrob. * Add strfry. +unistd +------ + +* Add __open_2/__open64_2. + malloc ------ diff --git a/libgcompat/unistd.c b/libgcompat/unistd.c index e19ec8e..d2f3097 100644 --- a/libgcompat/unistd.c +++ b/libgcompat/unistd.c @@ -1,4 +1,5 @@ #include /* assert */ +#include /* O_CREAT */ #include /* NGROUPS_MAX */ #include /* NULL, size_t */ #include /* confstr, getcwd, getgroups, ... */ @@ -90,6 +91,14 @@ pid_t __getpgid(pid_t pid) return getpgid(pid); } +int __open_2(const char *path, int oflag) +{ + assert(!(oflag & O_CREAT)); + + return open(path, oflag); +} +alias(__open_2, __open64_2); + /** * Read from a file, with buffer overflow checking. * -- cgit v1.2.3-70-g09d2