summaryrefslogtreecommitdiff
path: root/rpmkeys.c
diff options
context:
space:
mode:
authorDemi Marie Obenour <demi@invisiblethingslab.com>2021-04-12 11:30:51 -0400
committerFlorian Festi <ffesti@redhat.com>2022-01-21 15:44:28 +0100
commitfc8386be36a32f8462a0d16a2dd3e5e18f7fbc2d (patch)
tree731d96e0a283b8c52ac9a89f2208f8da2a50a4d4 /rpmkeys.c
parented07a187734addfa16be9ee922398e4ff9859f53 (diff)
downloadrpm-fc8386be36a32f8462a0d16a2dd3e5e18f7fbc2d.tar.gz
rpmkeys: exit non-zero on I/O errors
If writing to stdout or stderr fails, rpmkeys should exit with a non-zero status code.
Diffstat (limited to 'rpmkeys.c')
-rw-r--r--rpmkeys.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rpmkeys.c b/rpmkeys.c
index 542601c87..2c304de20 100644
--- a/rpmkeys.c
+++ b/rpmkeys.c
@@ -86,5 +86,9 @@ int main(int argc, char *argv[])
exit:
rpmtsFree(ts);
rpmcliFini(optCon);
+ fflush(stderr);
+ fflush(stdout);
+ if (ferror(stdout) || ferror(stderr))
+ return 255; /* I/O error */
return ec;
}