diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2025-03-16 22:53:29 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2025-03-16 22:53:29 +0100 |
commit | 68d5033cab94fa5d0761b5ab6141c2de863a2fed (patch) | |
tree | d51a1c3ea978155c0fffc77bbbb1d9e1cdca36d3 | |
parent | 45f9ce74d063912e23c9ef49e0c419fc1c5f8c8b (diff) |
pmore_file: check the return of fseek()
-rw-r--r-- | FICS/utils.c | 6 |
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); |