diff options
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/open64.c | 43 | ||||
-rw-r--r-- | sysdeps/posix/tempname.c | 8 |
2 files changed, 50 insertions, 1 deletions
diff --git a/sysdeps/posix/open64.c b/sysdeps/posix/open64.c new file mode 100644 index 0000000000..e409891980 --- /dev/null +++ b/sysdeps/posix/open64.c @@ -0,0 +1,43 @@ +/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <fcntl.h> +#include <stdarg.h> + +/* Open FILE with access OFLAG. If OFLAG includes O_CREAT, + a third argument is the file protection. */ +int +__open64 (file, oflag) + const char *file; + int oflag; +{ + int mode; + + if (oflag & O_CREAT) + { + va_list arg; + va_start (arg, oflag); + mode = va_arg (arg, int); + va_end (arg); + } + else + mode = 0; + + return __open (file, oflag | O_LARGEFILE, mode); +} +weak_alias (__open64, open64) diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index 3b82d3d366..291817c9ef 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -83,7 +83,7 @@ static const char letters[] = char * __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir, const char *pfx, int dir_search, size_t *lenptr, - FILE **streamptr) + FILE **streamptr, int large_file) { int saverrno = errno; static const char tmpdir[] = P_tmpdir; @@ -186,7 +186,13 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir, if (streamptr != NULL) { /* Try to create the file atomically. */ +#ifdef _G_OPEN64 + int fd = (large_file + ? __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666) + : _G_OPEN64 (buf, O_RDWR|O_CREAT|O_EXCL, 0666)); +#else int fd = __open (buf, O_RDWR|O_CREAT|O_EXCL, 0666); +#endif if (fd >= 0) { /* We got a new file that did not previously exist. |