diff options
| author | Andreas Schwab <schwab@suse.de> | 2024-07-08 15:52:35 +0200 |
|---|---|---|
| committer | Andreas Schwab <schwab@suse.de> | 2024-07-09 10:12:36 +0200 |
| commit | 2213b37b705843908355a89648017f4e597b2bbb (patch) | |
| tree | a7be1b62d8f381dc46a2f8e1ef991c72c360a190 /libio/genops.c | |
| parent | 895294e51d33039c1e718d2be88a9863670ac4d6 (diff) | |
| download | glibc-2213b37b705843908355a89648017f4e597b2bbb.tar.xz glibc-2213b37b705843908355a89648017f4e597b2bbb.zip | |
libio: handle opening a file when all files are closed (bug 31963)
_IO_list_all becomes NULL when all files (including standard files) are
closed.
Diffstat (limited to 'libio/genops.c')
| -rw-r--r-- | libio/genops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libio/genops.c b/libio/genops.c index 994ee9c0b1..99f5e80f20 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -119,7 +119,8 @@ _IO_link_in (struct _IO_FILE_plus *fp) if (_IO_vtable_offset ((FILE *) fp) == 0) { fp->file._prevchain = (FILE **) &_IO_list_all; - _IO_list_all->file._prevchain = &fp->file._chain; + if (_IO_list_all != NULL) + _IO_list_all->file._prevchain = &fp->file._chain; } _IO_list_all = fp; #ifdef _IO_MTSAFE_IO |
