From: Anthony Minessale Date: Tue, 10 Apr 2012 13:05:09 +0000 (-0500) Subject: FS-4097 --resolve X-Git-Tag: v1.2-rc1~17^2~271 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e31389ac9c4a3536bbc55fde4e0af641705b8109;p=thirdparty%2Ffreeswitch.git FS-4097 --resolve --- diff --git a/src/switch_utils.c b/src/switch_utils.c index 4edd9c8a68..0eccf2a67b 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -758,10 +758,6 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, rval = SWITCH_FALSE; } - if (unlink(filename) != 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename); - } - if (zstr(err)) { if (file) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to); @@ -777,6 +773,11 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, if (fd > -1) { close(fd); } + + if (unlink(filename) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", filename); + } + if (ifd > -1) { close(ifd); }