diff --git a/apps/src/uname.c b/apps/src/uname.c index 03b8ba70..380e00ff 100644 --- a/apps/src/uname.c +++ b/apps/src/uname.c @@ -9,7 +9,7 @@ int main() return 1; } - char buf[32]; + char buf[BUFSIZ]; fgets(buf, sizeof(buf), fp); printf("%s\n", buf); diff --git a/apps/src/uptime.c b/apps/src/uptime.c index 03e1ac01..ee6313d5 100644 --- a/apps/src/uptime.c +++ b/apps/src/uptime.c @@ -10,7 +10,7 @@ int main() return 1; } - char buf[32]; + char buf[BUFSIZ]; fgets(buf, sizeof(buf), fp); if (ferror(fp)) diff --git a/libs/libc/include/stdio.h b/libs/libc/include/stdio.h index 143408b8..796c81a8 100644 --- a/libs/libc/include/stdio.h +++ b/libs/libc/include/stdio.h @@ -8,6 +8,7 @@ #include #define FOPEN_MAX 32 +#define BUFSIZ 32 typedef struct { diff --git a/libs/libc/include/stdlib.h b/libs/libc/include/stdlib.h index 37018749..cb49672d 100644 --- a/libs/libc/include/stdlib.h +++ b/libs/libc/include/stdlib.h @@ -2,8 +2,14 @@ #define _STDLIB_H #include +#include #include +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +#define RAND_MAX INT_MAX + #ifdef __cplusplus extern "C" { diff --git a/libs/libc/src/file.cpp b/libs/libc/src/file.cpp index ce288401..55378383 100644 --- a/libs/libc/src/file.cpp +++ b/libs/libc/src/file.cpp @@ -13,8 +13,8 @@ void file_read_buf(FILE* stream) { if (!stream->f_buf) { - stream->f_buf = (char*)malloc(32); // FIXME: Handle errors. - stream->f_bufrsize = 32; + stream->f_buf = (char*)malloc(BUFSIZ); // FIXME: Handle errors. + stream->f_bufrsize = BUFSIZ; } stream->f_bufoff = 0; ssize_t nread = read(stream->f_fd, stream->f_buf, stream->f_bufrsize);