commit 0920be59b0c745710cea460b19155b5d1f924982 from: Markus Uhlin date: Sat Mar 7 22:52:15 2026 UTC truncate_file: return -1 on error commit - c492e45a4f044c2ac85a321ae3d520ede8f7fdff commit + 0920be59b0c745710cea460b19155b5d1f924982 blob - 04e275c03e443613a3d980f3ac9cd2d53cc9c5d5 blob + 3f257b6aa8db7e1f141df8cdd8fa94fe84fa26fb --- FICS/utils.c +++ 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++) {