aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/utils.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-12-01 08:58:49 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-12-01 08:58:49 +0100
commit987560ea87e892029c4d321efd08c57f465b53d4 (patch)
tree9e524f37360636d32f0263924131b52fad3bbd08 /FICS/utils.c
parent1572956589b6e071bab07fef06659aa38f2a2185 (diff)
Fixed ignored retvals
Diffstat (limited to 'FICS/utils.c')
-rw-r--r--FICS/utils.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index eaa2e4d..6872428 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -217,14 +217,10 @@ mail_file_to_address(char *addr, char *subj, char *fname)
return -1;
#ifdef SENDMAILPROG
fprintf(fp1, "To: %s\nSubject: %s\n", addr, subj);
- if ((fp2 = fopen(fname, "r")) == NULL)
+ if ((fp2 = fopen(fname, "r")) == NULL) // XXX
return -1;
- while (!feof(fp2)) {
- fgets(tmp, sizeof tmp, fp2);
- if (!feof(fp2)) {
- fputs(tmp, fp1);
- }
- }
+ while (fgets(tmp, sizeof tmp, fp2) != NULL && !feof(fp2))
+ fputs(tmp, fp1);
fclose(fp2);
#endif
pclose(fp1);
@@ -433,9 +429,7 @@ psend_file(int p, char *dir, char *file)
return -1;
while (!feof(fp) && --lcount > 0) {
- fgets(tmp, sizeof tmp, fp);
-
- if (!feof(fp))
+ if (fgets(tmp, sizeof tmp, fp) != NULL && !feof(fp))
net_send_string(parray[p].socket, tmp, 1);
}
@@ -473,12 +467,8 @@ psend_logoutfile(int p, char *dir, char *file)
if ((fp = fopen(fname, "r")) == NULL)
return -1;
- while (!feof(fp)) {
- fgets(tmp, sizeof tmp, fp);
-
- if (!feof(fp))
- net_send_string(parray[p].socket, tmp, 1);
- }
+ while (fgets(tmp, sizeof tmp, fp) != NULL && !feof(fp))
+ net_send_string(parray[p].socket, tmp, 1);
fclose(fp);
return 0;