fix return value for ExecIfTime when time is outside of the specified range (bug...
authorRussell Bryant <russell@russellbryant.com>
Thu, 26 May 2005 15:50:50 +0000 (15:50 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 26 May 2005 15:50:50 +0000 (15:50 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5773 65c4cc65-6c06-0410-ace0-fbb531ad65f3

pbx.c

diff --git a/pbx.c b/pbx.c
index 803c3fc..47a7cde 100755 (executable)
--- a/pbx.c
+++ b/pbx.c
@@ -5443,7 +5443,12 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
                ptr2 = ptr1;
                /* Separate the Application data ptr1 is the time spec ptr2 is the app|data*/
                strsep(&ptr2,"?");
                ptr2 = ptr1;
                /* Separate the Application data ptr1 is the time spec ptr2 is the app|data*/
                strsep(&ptr2,"?");
-               if (ast_build_timing(&timing, ptr1) && ast_check_timing(&timing)) {
+               if(!(res = ast_build_timing(&timing, ptr1))) {
+                       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage);
+                       res = -1;
+               }
+               
+               if (!res && ast_check_timing(&timing)) {
                        if (ptr2) {
                                /* ptr2 is now the app name 
                                   we're done with ptr1 now so recycle it and use it to point to the app args*/
                        if (ptr2) {
                                /* ptr2 is now the app name 
                                   we're done with ptr1 now so recycle it and use it to point to the app args*/
@@ -5461,9 +5466,6 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data)
                        } else {
                                ast_log(LOG_WARNING, "%s\n", usage);
                        }
                        } else {
                                ast_log(LOG_WARNING, "%s\n", usage);
                        }
-               } else {
-                       ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage);
-                       res = -1;
                }
        } else {
                ast_log(LOG_ERROR, "Memory Error!\n");
                }
        } else {
                ast_log(LOG_ERROR, "Memory Error!\n");