From fa185f0d4529c6d70f690306f431ca23662b9138 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 18 Feb 2020 13:02:37 +0100 Subject: : 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 --- libio/freopen.c | 4 ++-- libio/freopen64.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libio') 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); -- cgit v1.2.3-65-gdbad