xz: Validate Uncompressed Size from Block Header in list.c.

This affects only "xz -lvv". Normal decompression with xz
already detected if Block Header and Index had mismatched
Uncompressed Size fields. So this just makes "xz -lvv"
show such files as corrupt instead of showing the
Uncompressed Size from Index.
liblzma: Avoid a warning about a shadowed variable.

On Mac OS X wait() is declared in <sys/wait.h> that
we include one way or other so don't use "wait" as
a variable name.

Thanks to Christian Kujau.
Update THANKS.
Build: Require Automake 1.12 and use serial-tests option.

It should actually still work with Automake 1.10 if
the serial-tests option is removed. Automake 1.13 started
using parallel tests by default and the option to get
the old behavior isn't supported before 1.12.

At least for now, parallel tests don't improve anything
in XZ Utils but they hide the progress output from
test_compress.sh.
xz: Check the value of lzma_stream_flags.version in --list.

It is a no-op for now, but if an old xz version is used
together with a newer liblzma that supports something new,
then this check becomes important and will stop the old xz
from trying to parse files that it won't understand.
xz: Fix assertion related to posix_fadvise().

Input file can be a FIFO or something else that doesn't
support posix_fadvise() so don't check the return value
even with an assertion. Nothing bad happens if the call
to posix_fadvise() fails.
xz: Fix use of wrong variable in a fcntl() call.

Due to a wrong variable name, when writing a sparse file
to standard output, *all* file status flags were cleared
(to the extent the operating system allowed it) instead of
only clearing the O_APPEND flag. In practice this worked
fine in the common situations on GNU/Linux, but I didn't
check how it behaved elsewhere.

The original flags were still restored correctly. I still
changed the code to use a separate boolean variable to
indicate when the flags should be restored instead of
relying on a special value in stdout_flags.
xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.

POSIX says that fcntl(fd, F_SETFL, flags) returns -1 on
error and "other than -1" on success. This is how it is
documented e.g. on OpenBSD too. On Linux, success with
F_SETFL is always 0 (at least accorinding to fcntl(2)
from man-pages 3.51).
xz: Remove an outdated NetBSD-specific comment.

Nowadays errno == EFTYPE is documented in open(2).
xz: Use non-blocking I/O for the input file.
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.
xz: Fix return value type in io_write_buf().

It didn't affect the behavior of the code since -1
becomes true anyway.
xz: Use non-blocking I/O for the output file.

Now both reading and writing should be without
race conditions with signals.

They might still be signal handling issues left.
Signals are blocked during many operations to avoid
EINTR but it may cause problems e.g. if writing to
stderr blocks when trying to display an error message.
Man pages: Use similar syntax for synopsis as in xz.

The man pages of lzmainfo, xzmore, and xzdec had similar
constructs as the man page of xz had before the commit
eb6ca9854b8eb9fbf72497c1cf608d6b19d2d494. Eric S. Raymond
didn't mention these man pages in his bug report, but
it's nice to be consistent.
Update NEWS for 5.0.5.
xz: Silence a warning seen with _FORTIFY_SOURCE=2.

Thanks to Christian Hesse.
Update THANKS.
xz: Move some of the timing code into mytime.[hc].

This switches units from microseconds to milliseconds.

New clock_gettime(CLOCK_MONOTONIC) will be used if available.
There is still a fallback to gettimeofday().
xz: Fix the test when to read more input.

Testing for end of file was no longer correct after full flushing
became possible with --block-size=SIZE and --block-list=SIZES.
There was no bug in practice though because xz just made a few
unneeded zero-byte reads.
xz: Don't set src_eof=true after an I/O error because it's useless.