X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fopen.c;h=9a35f5b2a6add92db03e40da7b7c63a70f0d894a;hb=2464bbfa7a6b82eca7bf3f7d517515ed462f1b23;hp=97c30cee8c60ed5aa20bea42b64587caedb80d4f;hpb=810a812bee90d6bab12e9628dc7745eea49f188c;p=gnulib.git diff --git a/lib/open.c b/lib/open.c index 97c30cee8..9a35f5b2a 100644 --- a/lib/open.c +++ b/lib/open.c @@ -18,6 +18,18 @@ #include +/* Get the original definition of open. It might be defined as a macro. */ +#define __need_system_fcntl_h +#include +#undef __need_system_fcntl_h +#include + +static inline int +orig_open (const char *filename, int flags, mode_t mode) +{ + return open (filename, flags, mode); +} + /* Specification. */ #include @@ -32,7 +44,6 @@ int open (const char *filename, int flags, ...) -# undef open { mode_t mode; int fd; @@ -91,7 +102,7 @@ open (const char *filename, int flags, ...) } # endif - fd = open (filename, flags, mode); + fd = orig_open (filename, flags, mode); # if OPEN_TRAILING_SLASH_BUG /* If the filename ends in a slash and fd does not refer to a directory,