diff options
author | Samuel Holland <samuel@sholland.org> | 2018-09-11 22:45:16 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-09-11 22:50:44 -0500 |
commit | d8e667a638401df1bf881b16fcda6315f3fa3eb1 (patch) | |
tree | 0ef7b3c24ff1f349532b877ea325a437890d72e0 | |
parent | c7fc46aeb0ea9637deb242fbdba2e07cb63a44f6 (diff) | |
download | gcompat-d8e667a638401df1bf881b16fcda6315f3fa3eb1.tar.gz gcompat-d8e667a638401df1bf881b16fcda6315f3fa3eb1.tar.bz2 gcompat-d8e667a638401df1bf881b16fcda6315f3fa3eb1.tar.xz gcompat-d8e667a638401df1bf881b16fcda6315f3fa3eb1.zip |
unistd: Add __open_2 and its __open64_2 alias
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r-- | CHANGELOG.rst | 5 | ||||
-rw-r--r-- | libgcompat/unistd.c | 9 |
2 files changed, 14 insertions, 0 deletions
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.h> /* assert */ +#include <fcntl.h> /* O_CREAT */ #include <limits.h> /* NGROUPS_MAX */ #include <stddef.h> /* NULL, size_t */ #include <unistd.h> /* 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. * |