summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/io.c b/src/io.c
index da26a57..136153c 100644
--- a/src/io.c
+++ b/src/io.c
@@ -778,9 +778,11 @@ static int fdo_close(void *stream)
{
struct apk_fd_ostream *fos =
container_of(stream, struct apk_fd_ostream, os);
- int rc = fos->rc;
+ int rc;
fdo_flush(fos);
+ rc = fos->rc;
+
if (fos->fd > STDERR_FILENO &&
close(fos->fd) < 0)
rc = -errno;