aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
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);