From f20ac01059f1adff71890ca3fc5b9bf62df7e97d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 7 Jul 2008 00:41:05 +0000 Subject: 2008-07-06 Samuel Thibault * sysdeps/mach/hurd/open.c: Include . (__open_2): New function. (__open64_2): New alias to __open_2. * sysdeps/mach/hurd/openat.c: Include . (__openat_2): New function. (__openat64_2): New alias to __openat_2. --- sysdeps/mach/hurd/open.c | 13 +++++++++++++ sysdeps/mach/hurd/openat.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sysdeps/mach/hurd/open.c b/sysdeps/mach/hurd/open.c index bdfed5e311..519789f22f 100644 --- a/sysdeps/mach/hurd/open.c +++ b/sysdeps/mach/hurd/open.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -52,8 +53,20 @@ weak_alias (__libc_open, __open) libc_hidden_weak (__open) weak_alias (__libc_open, open) +int +__open_2 (file, oflag) + const char *file; + int oflag; +{ + if (oflag & O_CREAT) + __fortify_fail ("invalid open call: O_CREAT without mode"); + + return __open (file, oflag); +} + /* open64 is just the same as open for us. */ weak_alias (__libc_open, __libc_open64) weak_alias (__libc_open, __open64) libc_hidden_weak (_open64) weak_alias (__libc_open, open64) +strong_alias (__open_2, __open64_2) diff --git a/sysdeps/mach/hurd/openat.c b/sysdeps/mach/hurd/openat.c index 1faf857e16..f0a3404cd8 100644 --- a/sysdeps/mach/hurd/openat.c +++ b/sysdeps/mach/hurd/openat.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -56,7 +57,20 @@ __openat (fd, file, oflag) libc_hidden_def (__openat) weak_alias (__openat, openat) +int +__openat_2 (fd, file, oflag) + int fd; + const char *file; + int oflag; +{ + if (oflag & O_CREAT) + __fortify_fail ("invalid openat call: O_CREAT without mode"); + + return __openat (fd, file, oflag); +} + /* openat64 is just the same as openat for us. */ weak_alias (__openat, __openat64) libc_hidden_weak (__openat64) weak_alias (__openat, openat64) +strong_alias (__openat_2, __openat64_2) -- cgit 1.4.1