]> Dogcows Code - chaz/tar/commit
tar: don't assume O_NONBLOCK is benign on regular files
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Jan 2012 20:38:55 +0000 (12:38 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 6 Jan 2012 20:40:47 +0000 (12:40 -0800)
commit03858cf583ce299b836d8a848967ce290a6bf303
tree03955e6faa6ad04097b03669594756cb55fe0679
parent7a5a3708cb8b33494cd6ac64bfe163f631a33edf
tar: don't assume O_NONBLOCK is benign on regular files

On Data Migration Facility (DMF), High Peformance Storage System (HPSS),
and presumably other file systems based on hierarchical storage, opening
a regular file with O_NONBLOCK can cause later reads to fail with
errno == EAGAIN.  We need the O_NONBLOCK to avoid some security races.
Work around the problem by using fcntl to clear the O_NONBLOCK
flag if I/O fails with that errno value.
Problem reported by Vitezslav Cizek in
<http://lists.gnu.org/archive/html/bug-tar/2012-01/msg00000.html>.
* src/common.h (blocking_read, blocking_write): New decls.
* src/misc.c (blocking_read, blocking_write): New functions.
* src/compare.c (process_rawdata):
* src/create.c (dump_regular_file):
* src/extract.c (extract_file):
* src/sparse.c (sparse_scan_file, sparse_extract_region):
src/common.h
src/compare.c
src/create.c
src/extract.c
src/misc.c
src/sparse.c
This page took 0.019817 seconds and 4 git commands to generate.