Fix bugs discoverent by Coverity. rhbz#905051

This is a partial backport of 93c6e6f9298928dcb140797d9fe8ff9038790423.

Most bugs are either outright bogus (rhbz_array_size is never <0)
or won't happen in practice (fstat won't fail on a file we just created
ourselves). Nevertheless, one bug is real:

if (flags & LIBREPORT_NOWAIT)...

is WRONG, because LIBREPORT_NOWAIT constant is in fact 0!
We must check for that bit this way:

if (!(flags & LIBREPORT_WAIT))...

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Jiri Moskovcak <jmoskovc@redhat.com>