xz: Use the self-pipe trick to avoid a race condition with signals.
authorLasse Collin <lasse.collin@tukaani.org>
Fri, 28 Jun 2013 20:48:05 +0000 (23:48 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 28 Jun 2013 20:48:05 +0000 (23:48 +0300)
commit9dc319eabb34a826f4945f91c71620f14a60e9e2
tree7f92afc9d6f9031d9dcfded0f8231fd5ee7f16d6
parent3541bc79d0cfabc0ad155c99bfdad1289f17fec3
xz: Use the self-pipe trick to avoid a race condition with signals.

It is possible that a signal to set user_abort arrives right
before a blocking system call is made. In this case the call
may block until another signal arrives, while the wanted
behavior is to make xz clean up and exit as soon as possible.

After this commit, the race condition is avoided with the
input side which already uses non-blocking I/O. The output
side still uses blocking I/O and thus has the race condition.
src/xz/file_io.c
src/xz/file_io.h
src/xz/signals.c