From 68d5033cab94fa5d0761b5ab6141c2de863a2fed Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 16 Mar 2025 22:53:29 +0100 Subject: pmore_file: check the return of fseek() --- FICS/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'FICS') diff --git a/FICS/utils.c b/FICS/utils.c index 66b7d56..7b17a2c 100644 --- a/FICS/utils.c +++ b/FICS/utils.c @@ -499,10 +499,12 @@ pmore_file(int p) if ((fp = fopen(parray[p].last_file, "r")) == NULL) { pprintf(p, "File not found!\n"); return -1; + } else if (fseek(fp, parray[p].last_file_byte, SEEK_SET) == -1) { + pprintf(p, "Unable to set the file position indicator.\n"); + fclose(fp); + return -1; } - fseek(fp, parray[p].last_file_byte, SEEK_SET); - while (!feof(fp) && --lcount > 0) { if (fgets(tmp, sizeof tmp, fp) != NULL && !feof(fp)) net_send_string(parray[p].socket, tmp, 1); -- cgit v1.2.3