[Openais] Patch for more graceful error handling w/ AMF

Russell Bryant russell at digium.com
Thu Sep 20 05:56:33 PDT 2007


Drew Moseley wrote:
> Index: exec/util.c
> ===================================================================
> --- exec/util.c    (revision 1452)
> +++ exec/util.c    (working copy)
> @@ -50,7 +50,11 @@
>   */
>  int name_match(SaNameT *name1, SaNameT *name2)
>  {
> -    if (name1->length == name2->length) {
> +    if ((name1 == NULL) && (name2 != NULL)) {
> +        return 0;
> +    } else if ((name2 == NULL) && (name1 != NULL)) {
> +        return 0;
> +    } else if (name1->length == name2->length) {
>          return ((strncmp ((char *)name1->value, (char *)name2->value,
>              name1->length)) == 0);
>      }

If it is determined that this check is necessary and should be added, then it
can be simplified to a single if statement instead of 2.

if (name1 == NULL || name2 == NULL) {
    return 0;
...

-- 
Russell Bryant
Software Engineer
Digium, Inc.


More information about the Openais mailing list