From 889f39ac2919ae9adb8473e76b5d940c9f5646c3 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sun, 7 Apr 2024 18:59:08 +0300 Subject: [PATCH] fixup: freadln.c: test: use `return` instead of `exit` --- c-programming/io/freadln.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c-programming/io/freadln.c b/c-programming/io/freadln.c index 304fa74..1498812 100644 --- a/c-programming/io/freadln.c +++ b/c-programming/io/freadln.c @@ -139,13 +139,13 @@ int main(void) { FILE* f = fopen(TEST_FILE, "w"); if (f == NULL) { perror("fopen"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } fprintf(f, "Hello, world!\nAnother line\n\n"); FILE* new_f = freopen(TEST_FILE, "r", f); if (new_f == NULL) { perror("freopen"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } f = new_f; @@ -162,7 +162,7 @@ int main(void) { int result = freadln(f, &line, &line_length); if (result == freadln_ERROR) { perror("freadln"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } else if (result == freadln_EOF || feof(f)) { printf("File: EOF, breaking the loop (returned by function? %s, " "feof? %s)\n", YN(result == freadln_EOF), YN(feof(f)));