From 0920be59b0c745710cea460b19155b5d1f924982 Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sat, 7 Mar 2026 23:52:15 +0100 Subject: truncate_file: return -1 on error --- FICS/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'FICS/utils.c') diff --git a/FICS/utils.c b/FICS/utils.c index 04e275c..3f257b6 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -952,7 +952,7 @@ truncate_file(char *file, int lines) lines = MAX_TRUNC_SIZE; if ((fp = fopen(file, "r")) == NULL) - return 1; + return -1; while (fgets(tBuf[bptr], MAX_LINE_SIZE, fp) != NULL) { if (strchr(tBuf[bptr], '\n') == NULL) { @@ -975,11 +975,11 @@ truncate_file(char *file, int lines) if ((fd = open(file, g_open_flags[OPFL_WRITE], g_open_modes)) < 0) { warn("%s: open", __func__); - return 1; + return -1; } else if ((fp = fdopen(fd, "w")) == NULL) { warn("%s: fdopen", __func__); close(fd); - return 1; + return -1; } for (i = 0; i < lines; i++) { -- cgit v1.2.3