summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/__stdio_exit.c2
-rw-r--r--src/stdio/__toread.c9
-rw-r--r--src/stdio/__towrite.c8
3 files changed, 8 insertions, 11 deletions
diff --git a/src/stdio/__stdio_exit.c b/src/stdio/__stdio_exit.c
index 0fb33234..e4380aaf 100644
--- a/src/stdio/__stdio_exit.c
+++ b/src/stdio/__stdio_exit.c
@@ -21,3 +21,5 @@ void __stdio_exit(void)
close_file(__stdin_used);
close_file(__stdout_used);
}
+
+weak_alias(__stdio_exit, __stdio_exit_needed);
diff --git a/src/stdio/__toread.c b/src/stdio/__toread.c
index 2e804f64..52624f3d 100644
--- a/src/stdio/__toread.c
+++ b/src/stdio/__toread.c
@@ -13,12 +13,9 @@ int __toread(FILE *f)
return 0;
}
-static const int dummy = 0;
-weak_alias(dummy, __towrite_used);
+void __stdio_exit_needed(void);
-void __stdio_exit(void);
-
-void __seek_on_exit()
+void __toread_needs_stdio_exit()
{
- if (!__towrite_used) __stdio_exit();
+ __stdio_exit_needed();
}
diff --git a/src/stdio/__towrite.c b/src/stdio/__towrite.c
index 380ea396..0a69d926 100644
--- a/src/stdio/__towrite.c
+++ b/src/stdio/__towrite.c
@@ -17,11 +17,9 @@ int __towrite(FILE *f)
return 0;
}
-const int __towrite_used = 1;
+void __stdio_exit_needed(void);
-void __stdio_exit(void);
-
-void __flush_on_exit()
+void __towrite_needs_stdio_exit()
{
- __stdio_exit();
+ __stdio_exit_needed();
}