# HG changeset patch # User Pádraig Brady
# Date 1424299051 0 # Node ID 58c1b50299a68b8d0a6b07a8db5699925cf738a3 # Parent 7a288a43abf946a24070e109c932a0b411249ef9 getopt: give accurate ambiguity diagnostic on mem exhaustion * lib/getopt.c (_getopt_internal_r): The previous commit broke out the loop too early, which could give a false indication of ambiguous options under memory exhaustion. diff --git a/lib/getopt.c b/lib/getopt.c --- a/lib/getopt.c +++ b/lib/getopt.c @@ -527,6 +527,8 @@ pfound = p; indfound = option_index; } + else if (ambig) + ; /* Taking simpler path to handling ambiguities. */ else if (long_only || pfound->has_arg != p->has_arg || pfound->flag != p->flag @@ -539,10 +541,9 @@ struct option_list *newp = malloc (sizeof (*newp)); if (newp == NULL) { - ambig = 1; /* Use simpler fallback message. */ free_option_list (ambig_list); ambig_list = NULL; - break; + ambig = 1; /* Use simpler fallback message. */ } else #endif