aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-12-01 10:21:13 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-12-01 10:21:13 +0100
commit59469ea9107cb75ec60abf14440292ea691ab194 (patch)
tree0228c4042c544ca7bf225d66c8cb4f648c336b13 /FICS
parentd7d636b61a6f67e8cd3ad77eced5b6366b119b7b (diff)
mail_file_to_address: added missing call to pclose() and moved the fprintf() call
Diffstat (limited to 'FICS')
-rw-r--r--FICS/utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/FICS/utils.c b/FICS/utils.c
index ced5c6c..d9fac79 100644
--- a/FICS/utils.c
+++ b/FICS/utils.c
@@ -218,9 +218,13 @@ mail_file_to_address(char *addr, char *subj, char *fname)
if ((fp1 = popen(com, "w")) == NULL)
return -1;
#ifdef SENDMAILPROG
- fprintf(fp1, "To: %s\nSubject: %s\n", addr, subj);
- if ((fp2 = fopen(fname, "r")) == NULL) // XXX
+ if ((fp2 = fopen(fname, "r")) == NULL) {
+ pclose(fp1);
return -1;
+ }
+
+ fprintf(fp1, "To: %s\nSubject: %s\n", addr, subj);
+
while (fgets(tmp, sizeof tmp, fp2) != NULL && !feof(fp2))
fputs(tmp, fp1);
fclose(fp2);