]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4097 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 10 Apr 2012 13:05:09 +0000 (08:05 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 10 Apr 2012 13:05:09 +0000 (08:05 -0500)
src/switch_utils.c

index 4edd9c8a6833ffe67ed1e10fe04ad0f39f009106..0eccf2a67b334b83c98ba72efcfb1744a916a241 100644 (file)
@@ -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);
        }