aboutsummaryrefslogtreecommitdiff
path: root/argp/argp-help.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-03-15 20:09:02 +0000
committerUlrich Drepper <drepper@redhat.com>2007-03-15 20:09:02 +0000
commit44969f17bb8e323ab66799f73a05d23a5a2cf83a (patch)
tree6df32fdd8e591f15fa7d606c07f5370615dbfd15 /argp/argp-help.c
parent05eb8975048ff270f6c0d61332e2130bcf2c9b6c (diff)
downloadglibc-44969f17bb8e323ab66799f73a05d23a5a2cf83a.tar
glibc-44969f17bb8e323ab66799f73a05d23a5a2cf83a.tar.gz
glibc-44969f17bb8e323ab66799f73a05d23a5a2cf83a.tar.bz2
glibc-44969f17bb8e323ab66799f73a05d23a5a2cf83a.zip
[BZ #4101]
* argp/argp-help.c (hol_cluster_cmp): Fix comparisons used to find ancestors with the same depths. Patch by Niels Moeller <nisse@lysator.liu.se>. (filter_doc): Don't crash if argp is NULL. * argp/Makefile (tests): Add tst-argp2. * argp/tst-argp2.c: New test. 2007-03-15 Jakub Jelinek <jakub@redhat.com>
Diffstat (limited to 'argp/argp-help.c')
-rw-r--r--argp/argp-help.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/argp/argp-help.c b/argp/argp-help.c
index 13c0820710..c12b10e235 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,6 @@
/* Hierarchial argument parsing help output
- Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -672,9 +673,9 @@ hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
{
/* If one cluster is deeper than the other, use its ancestor at the same
level, so that finding the common ancestor is straightforward. */
- while (cl1->depth < cl2->depth)
+ while (cl1->depth > cl2->depth)
cl1 = cl1->parent;
- while (cl2->depth < cl1->depth)
+ while (cl2->depth > cl1->depth)
cl2 = cl2->parent;
/* Now reduce both clusters to their ancestors at the point where both have
@@ -987,7 +988,7 @@ static const char *
filter_doc (const char *doc, int key, const struct argp *argp,
const struct argp_state *state)
{
- if (argp->help_filter)
+ if (argp && argp->help_filter)
/* We must apply a user filter to this output. */
{
void *input = __argp_input (argp, state);