diff options
| author | Markus Uhlin <markus@nifty-networks.net> | 2026-03-07 23:52:15 +0100 |
|---|---|---|
| committer | Markus Uhlin <markus@nifty-networks.net> | 2026-03-07 23:52:15 +0100 |
| commit | 0920be59b0c745710cea460b19155b5d1f924982 (patch) | |
| tree | 8fccb59ac71794b94031e0fc53cb0df92dceee7c /FICS | |
| parent | c492e45a4f044c2ac85a321ae3d520ede8f7fdff (diff) | |
truncate_file: return -1 on error
Diffstat (limited to 'FICS')
| -rw-r--r-- | FICS/utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
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++) { |
