summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-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;
}