summaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-02-18 13:02:37 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-02-18 13:42:29 +0100
commitfa185f0d4529c6d70f690306f431ca23662b9138 (patch)
treead2719a1dd633d74a7a61ad59eefd08c944e19c6 /libio
parente4a399921390509418826e8e8995d2441f29e243 (diff)
downloadglibc-fa185f0d4529c6d70f690306f431ca23662b9138.tar.gz
<fd_to_filename.h>: Add type safety and port to Hurd
The new type struct fd_to_filename makes the allocation of the backing storage explicit. Hurd uses /dev/fd, not /proc/self/fd. Co-Authored-By: Paul Eggert <eggert@cs.ucla.edu>
Diffstat (limited to 'libio')
-rw-r--r--libio/freopen.c4
-rw-r--r--libio/freopen64.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/libio/freopen.c b/libio/freopen.c
index bab3ba204a..884cdb2961 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -37,7 +37,7 @@ FILE *
freopen (const char *filename, const char *mode, FILE *fp)
{
FILE *result = NULL;
- char fdfilename[FD_TO_FILENAME_SIZE];
+ struct fd_to_filename fdfilename;
CHECK_FILE (fp, NULL);
@@ -50,7 +50,7 @@ freopen (const char *filename, const char *mode, FILE *fp)
int fd = _IO_fileno (fp);
const char *gfilename
- = filename != NULL ? filename : fd_to_filename (fd, fdfilename);
+ = filename != NULL ? filename : __fd_to_filename (fd, &fdfilename);
fp->_flags2 |= _IO_FLAGS2_NOCLOSE;
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
diff --git a/libio/freopen64.c b/libio/freopen64.c
index c0ce604e6e..0d2c5264c7 100644
--- a/libio/freopen64.c
+++ b/libio/freopen64.c
@@ -36,7 +36,7 @@ FILE *
freopen64 (const char *filename, const char *mode, FILE *fp)
{
FILE *result = NULL;
- char fdfilename[FD_TO_FILENAME_SIZE];
+ struct fd_to_filename fdfilename;
CHECK_FILE (fp, NULL);
@@ -49,7 +49,7 @@ freopen64 (const char *filename, const char *mode, FILE *fp)
int fd = _IO_fileno (fp);
const char *gfilename
- = filename != NULL ? filename : fd_to_filename (fd, fdfilename);
+ = filename != NULL ? filename : __fd_to_filename (fd, &fdfilename);
fp->_flags2 |= _IO_FLAGS2_NOCLOSE;
_IO_file_close_it (fp);