summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg2011-02-24 10:17:44 +0100
committerAndreas Eversberg2011-02-24 10:17:44 +0100
commitd4097e35584a9490c778d93b7667930a834481e7 (patch)
tree4c70d13aa9bf387c8221bcad13a34f28708cab29
parent[chan_lcr] Unloading chan_lcr is now possible (diff)
downloadlcr-d4097e35584a9490c778d93b7667930a834481e7.tar.gz
lcr-d4097e35584a9490c778d93b7667930a834481e7.tar.xz
lcr-d4097e35584a9490c778d93b7667930a834481e7.zip
[mail] Prevent bustling error message when sending mail without attachment
this cosmetic patch removes a false error message from LCR's mail when no attachment is wanted. thanx to bodo for providing this patch!
-rw-r--r--mail.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mail.c b/mail.c
index 445e268..0e34b77 100644
--- a/mail.c
+++ b/mail.c
@@ -99,7 +99,8 @@ static void *mail_child(void *arg)
fprintf(ph, "\n * date: %s %d %d %d:%02d\n\n", months[mon], mday, year+1900, hour, min);
/* attach audio file */
- if ((filename[0]) && ((fh = open(filename, O_RDONLY)))) {
+ if (filename[0]) {
+ if ((fh = open(filename, O_RDONLY))) {
while(strchr(filename, '/'))
filename = strchr(filename, '/')+1;
fprintf(ph, "--next_part\n");
@@ -144,11 +145,12 @@ static void *mail_child(void *arg)
fprintf(ph, "\n\n");
close(fh);
- } else {
+ } else {
SPRINT(buffer, "-Error- Failed to read audio file: '%s'.\n\n", filename);
fprintf(ph, "%s", buffer);
PERROR("%s", buffer);
- }
+ }
+ }
/* finish mail */
fprintf(ph, ".\n");