From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/tests/posix/fdopen.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 lib/mlibc/tests/posix/fdopen.c (limited to 'lib/mlibc/tests/posix/fdopen.c') diff --git a/lib/mlibc/tests/posix/fdopen.c b/lib/mlibc/tests/posix/fdopen.c deleted file mode 100644 index 1066bfb..0000000 --- a/lib/mlibc/tests/posix/fdopen.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -#include -#include - -#define TEST_FILE "fdopen.tmp" - -int main() { - int fd = open(TEST_FILE, O_CREAT | O_RDWR, 0666); - assert(fd >= 0); - - char *str = "mlibc fdopen test"; - assert(write(fd, str, strlen(str))); - - // Seek to the beginning, then reopen with fdopen in append mode. - lseek(fd, 0, SEEK_SET); - FILE *file = fdopen(fd, "a"); - assert(file); - - // Append and close. - str = " appended"; - fwrite(str, strlen(str), 1, file); - fflush(file); - fclose(file); - - // Open it again and check that the append succeeded. - fd = open(TEST_FILE, O_RDONLY); - assert(fd >= 0); - file = fdopen(fd, "r"); - assert(file); - str = "mlibc fdopen test appended"; - char buf[100] = {0}; - assert(fread(buf, 1, strlen(str), file)); - assert(!strcmp(buf, str)); - fclose(file); -} -- cgit v1.2.3