OSDN Git Service

Make FILE*s less usable after fclose(3).
authorElliott Hughes <enh@google.com>
Tue, 19 Jan 2016 23:46:05 +0000 (15:46 -0800)
committerElliott Hughes <enh@google.com>
Tue, 19 Jan 2016 23:46:05 +0000 (15:46 -0800)
commit923f165b29866cba1bd077117127f576763b384d
treec5c05829f199caba0e483769023eed1e3d37206c
parent579f42b78922d8c70e19ea77d2818ec17d0dc6a7
Make FILE*s less usable after fclose(3).

BSD doesn't invalidate the fd stored in struct FILE, which can make
it possible (via fileno(3), for example), to perform operations on
an fd you didn't intend to (rather than just failing with EBADF).

Fixing this makes the code slightly simpler anyway, and might help
catch bad code before it ships.

Bug: http://stackoverflow.com/questions/10816837/fclose-works-differently-on-android-and-linux
Change-Id: I9db74584038229499197a2695c70b58ed0372a87
libc/Android.mk
libc/stdio/findfp.c
libc/stdio/local.h
libc/stdio/stdio_ext.cpp
libc/upstream-openbsd/lib/libc/stdio/fclose.c [deleted file]
libc/upstream-openbsd/lib/libc/stdio/fileno.c [deleted file]
tests/stdio_test.cpp