Close a race when statting and reading files.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Jan 2013 05:12:08 +0000 (21:12 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Jan 2013 05:12:08 +0000 (21:12 -0800)
commit6772211202c57f0dc96e5725f882a2fa4ee98d2d
tree7e2ca991fa357834552b26980ca392d6f982559e
parent0eb8768885fab926acfae16d2fae8d39a72d8f35
Close a race when statting and reading files.

* fileio.c (Finsert_file_contents): Use open+fstat, not stat+open.
This avoids a race if the file is renamed between stat and open.
This race is not the problem originally noted in Bug#13149;
see <http://bugs.gnu.org/13149#73> and later messages in the thread.
src/ChangeLog
src/fileio.c