summaryrefslogtreecommitdiff
path: root/05/stdio.h
diff options
context:
space:
mode:
Diffstat (limited to '05/stdio.h')
-rw-r--r--05/stdio.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/05/stdio.h b/05/stdio.h
index 3b53d2b..e5a04cc 100644
--- a/05/stdio.h
+++ b/05/stdio.h
@@ -1683,7 +1683,8 @@ int _fopen_flags_from_mode(const char *mode) {
}
FILE *_FILE_from_fd(int fd) {
- FILE *fp = calloc(1, sizeof(FILE));
+ FILE *fp = malloc(sizeof(FILE));
+ // NB: our malloc implementation returns zeroed memory
fp->fd = fd;
return fp;
}
@@ -2274,7 +2275,9 @@ int scanf(const char *format, ...) {
}
-void perror(const char *s); // @TODO
+void perror(const char *s) {
+ printf("%s: %s\n", s, strerror(errno));
+}
#undef STB_SPRINTF_MIN