aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2025-03-16 22:53:29 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2025-03-16 22:53:29 +0100
commit68d5033cab94fa5d0761b5ab6141c2de863a2fed (patch)
treed51a1c3ea978155c0fffc77bbbb1d9e1cdca36d3
parent45f9ce74d063912e23c9ef49e0c419fc1c5f8c8b (diff)
pmore_file: check the return of fseek()
-rw-r--r--FICS/utils.c6
1 files changed, 4 insertions, 2 deletions
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);