summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-11-04 16:18:14 -0400
committermidipix <writeonce@midipix.org>2017-11-04 16:18:14 -0400
commit0c8cc09aea17ecb1220818fb453558f900380d47 (patch)
treed21ba86648c1d69979938fba5f5ba2b0299bcbaa
parentb8fd4d5210fccb7dbbee5cf0157d002dd8038874 (diff)
downloadapimagic-0c8cc09aea17ecb1220818fb453558f900380d47.tar.bz2
apimagic-0c8cc09aea17ecb1220818fb453558f900380d47.tar.xz
amgc_stdin_to_tmp(): call fflush() upon return.
-rw-r--r--src/driver/amgc_unit_ctx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/driver/amgc_unit_ctx.c b/src/driver/amgc_unit_ctx.c
index 40f4257..17568d2 100644
--- a/src/driver/amgc_unit_ctx.c
+++ b/src/driver/amgc_unit_ctx.c
@@ -4,6 +4,7 @@
/* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */
/**********************************************************/
+#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
@@ -82,6 +83,11 @@ static FILE * amgc_stdin_to_tmp(const struct amgc_driver_ctx * dctx)
nread = read(0,buf,sizeof(buf)-1);
}
+ if (fflush(ftmp)) {
+ fclose(ftmp);
+ return 0;
+ }
+
return ftmp;
}