]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 371394,371398 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Thu, 16 Aug 2012 23:25:52 +0000 (23:25 +0000)
committerAutomerge script <automerge@asterisk.org>
Thu, 16 Aug 2012 23:25:52 +0000 (23:25 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r371394 | kmoore | 2012-08-16 17:42:53 -0500 (Thu, 16 Aug 2012) | 11 lines

  Add module reload instrumentation for TEST_FRAMEWORK

  This adds AMI events for module reloads when Asterisk is built with
  TEST_FRAMEWORK enabled and corrects generation of the module load AMI
  event.

  (issue PQ-1126)
  ........

  Merged revisions 371393 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................
  r371398 | twilson | 2012-08-16 17:50:12 -0500 (Thu, 16 Aug 2012) | 13 lines

  Handle integer over/under-flow in ast_parse_args

  The strtol family of functions will return *_MIN/*_MAX on overflow. To
  detect when an overflow has happened, errno must be set to 0 before
  calling the function, then checked afterward.

  (closes issue ASTERISK-20120)
  Reported by: Matt Jordan
  Review: https://reviewboard.asterisk.org/r/2073/
  ........

  Merged revisions 371392 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

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

main/config.c
main/loader.c

index c3c5b9d429eca02632b774ea8e1abcae65040f47..e850ee7be3e3cdfef97ba6f9225767d2a7f85454 100644 (file)
@@ -2689,8 +2689,9 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
                        error = 1;
                        goto int32_done;
                }
+               errno = 0;
                x = strtol(arg, &endptr, 0);
-               if (*endptr || x < INT32_MIN || x > INT32_MAX) {
+               if (*endptr || errno || x < INT32_MIN || x > INT32_MAX) {
                        /* Parse error, or type out of int32_t bounds */
                        error = 1;
                        goto int32_done;
@@ -2736,8 +2737,9 @@ int32_done:
                        error = 1;
                        goto uint32_done;
                }
+               errno = 0;
                x = strtoul(arg, &endptr, 0);
-               if (*endptr || x > UINT32_MAX) {
+               if (*endptr || errno || x > UINT32_MAX) {
                        error = 1;
                        goto uint32_done;
                }
index 4d1da976deed1825e99fdf409733ec38f6085a38..e69a82cfc2543bdc1511849c6225f59c5d00264f 100644 (file)
@@ -745,6 +745,8 @@ int ast_module_reload(const char *name)
                }
 
                if (!info->reload) {    /* cannot be reloaded */
+                       /* Nothing to reload, so reload is successful */
+                       ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
                        if (res < 1)    /* store result if possible */
                                res = 1;        /* 1 = no reload() method */
                        continue;
@@ -752,7 +754,9 @@ int ast_module_reload(const char *name)
 
                res = 2;
                ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description);
-               info->reload();
+               if (!info->reload()) {
+                       ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
+               }
        }
        AST_LIST_UNLOCK(&module_list);
 
@@ -902,7 +906,9 @@ int ast_load_resource(const char *resource_name)
        int res;
        AST_LIST_LOCK(&module_list);
        res = load_resource(resource_name, 0, NULL, 0);
-       ast_test_suite_event_notify("MODULE_LOAD", "Message: %s", resource_name);
+       if (!res) {
+               ast_test_suite_event_notify("MODULE_LOAD", "Message: %s", resource_name);
+       }
        AST_LIST_UNLOCK(&module_list);
 
        return res;