]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Properly detect when a sound file doesn't exist
authorTerry Wilson <twilson@digium.com>
Fri, 3 Sep 2010 16:10:23 +0000 (16:10 +0000)
committerTerry Wilson <twilson@digium.com>
Fri, 3 Sep 2010 16:10:23 +0000 (16:10 +0000)
ast_fileexists returns -1 for error and 0 for a non-existant file. The existing
code treated missing files as though they were existed.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@284881 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_chanspy.c

index b7c915b45731e08b8e54bc665dc653a7928b8816..57309e5b5ba275cb3c433281b13f47016d7fe90e 100644 (file)
@@ -633,7 +633,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
                        ast_channel_unlock(peer);
 
                        if (!ast_test_flag(flags, OPTION_QUIET)) {
-                               if (ast_fileexists(peer_name, NULL, NULL) != -1) {
+                               if (ast_fileexists(peer_name, NULL, NULL) > 0) {
                                        res = ast_streamfile(chan, peer_name, chan->language);
                                        if (!res)
                                                res = ast_waitstream(chan, "");