* sysdeps/posix/tempname.c (__gen_tempname): Change attempts_min

into a macro.  Use preprocessor to decide how to initialize
	attempts [Coverity CID 67].

	* io/fts.c (fts_build): Comment out dead code [Coverity CID 68].

	* sunrpc/rpc_parse.c (def_union): Comment out dead code
	[Coverity CID 70].

	* locale/programs/linereader.c (lr_token): Remove duplicate
	handling of EOF [Coverity CID 71].

	* locale/programs/ld-numeric.c (numeric_read) [case tok_grouping]:
	We bail out early if ignore_content is set, so there is no need to
	check it later again [Coverity CID 72].

	* inet/inet6_option.c (inet6_option_find): Check *tptrp for NULL,
	not tptrp [Coverity CID 73].

	* inet/inet6_option.c (inet6_option_next): Check *tptrp for NULL,
	not tptrp [Coverity CID 74].

	* misc/tsearch.c (__tsearch): Don't rotate tree if memory
	allocation failed [Coverity CID 78].
This commit is contained in:
Ulrich Drepper 2006-04-07 20:25:36 +00:00
parent 2035d91c38
commit cec4091671
8 changed files with 65 additions and 34 deletions

View File

@ -1,3 +1,30 @@
2006-04-07 Ulrich Drepper <drepper@redhat.com>
* sysdeps/posix/tempname.c (__gen_tempname): Change attempts_min
into a macro. Use preprocessor to decide how to initialize
attempts [Coverity CID 67].
* io/fts.c (fts_build): Comment out dead code [Coverity CID 68].
* sunrpc/rpc_parse.c (def_union): Comment out dead code
[Coverity CID 70].
* locale/programs/linereader.c (lr_token): Remove duplicate
handling of EOF [Coverity CID 71].
* locale/programs/ld-numeric.c (numeric_read) [case tok_grouping]:
We bail out early if ignore_content is set, so there is no need to
check it later again [Coverity CID 72].
* inet/inet6_option.c (inet6_option_find): Check *tptrp for NULL,
not tptrp [Coverity CID 73].
* inet/inet6_option.c (inet6_option_next): Check *tptrp for NULL,
not tptrp [Coverity CID 74].
* misc/tsearch.c (__tsearch): Don't rotate tree if memory
allocation failed [Coverity CID 78].
2006-04-07 Jakub Jelinek <jakub@redhat.com>
* sysdeps/generic/unwind-dw2.c (execute_cfa_program): Fix typo in

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
@ -251,7 +251,7 @@ inet6_option_next (cmsg, tptrp)
const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
const uint8_t *result;
if (tptrp == NULL)
if (*tptrp == NULL)
/* This is the first call, return the first option if there is one. */
result = (const uint8_t *) (ip6e + 1);
else
@ -308,7 +308,7 @@ inet6_option_find (cmsg, tptrp, type)
const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
const uint8_t *next;
if (tptrp == NULL)
if (*tptrp == NULL)
/* This is the first call, return the first option if there is one. */
next = (const uint8_t *) (ip6e + 1);
else

View File

@ -747,6 +747,10 @@ mem1: saved_errno = errno;
p->fts_flags |= FTS_ISW;
#endif
#if 0
/* Unreachable code. cderrno is only ever set to a nonnull
value if dirp is closed at the same time. But then we
cannot enter this loop. */
if (cderrno) {
if (nlinks) {
p->fts_info = FTS_NS;
@ -754,7 +758,9 @@ mem1: saved_errno = errno;
} else
p->fts_info = FTS_NSOK;
p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0
} else
#endif
if (nlinks == 0
#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
|| (nostat &&
dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc.
/* Copyright (C) 1995-2002,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@ -302,7 +302,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
{
size_t act = 0;
size_t max = 10;
char *grouping = ignore_content ? NULL : xmalloc (max);
char *grouping = xmalloc (max);
do
{
@ -321,24 +321,20 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
}
if (now->tok == tok_minus1)
{
if (!ignore_content)
grouping[act++] = '\177';
}
else if (now->val.num == 0)
{
/* A value of 0 disables grouping from here on but
we must not store a NUL character since this
terminates the string. Use something different
which must not be used otherwise. */
if (!ignore_content)
grouping[act++] = '\377';
}
else if (now->val.num > 126)
lr_error (ldfile, _("\
%s: values for field `%s' must be smaller than 127"),
"LC_NUMERIC", "grouping");
else if (!ignore_content)
else
grouping[act++] = now->val.num;
/* Next must be semicolon. */
@ -353,14 +349,11 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
if (now->tok != tok_eol)
goto err_label;
if (!ignore_content)
{
grouping[act++] = '\0';
numeric->grouping = xrealloc (grouping, act);
numeric->grouping_len = act;
}
}
break;
case tok_end:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996-2001,2002,2003,2004,2005 Free Software Foundation, Inc.
/* Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@ -214,12 +214,6 @@ lr_token (struct linereader *lr, const struct charmap_t *charmap,
}
while (isspace (ch));
if (ch == EOF)
{
lr->token.tok = tok_eof;
return &lr->token;
};
if (ch != lr->comment_char)
break;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 2000, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Bernd Schmidt <crux@Pool.Informatik.RWTH-Aachen.DE>, 1997.
@ -285,11 +285,12 @@ __tsearch (const void *key, void **vrootp, __compar_fn_t compar)
q->key = key; /* initialize new node */
q->red = 1;
q->left = q->right = NULL;
}
if (nextp != rootp)
/* There may be two red edges in a row now, which we must avoid by
rotating the tree. */
maybe_split_for_insert (nextp, rootp, parentp, r, p_r, 1);
}
return q;
}

View File

@ -303,7 +303,9 @@ def_union (definition *defp)
case_list *cases;
/* case_list *tcase; */
case_list **tailp;
#if 0
int flag;
#endif
defp->def_kind = DEF_UNION;
scan (TOK_IDENT, &tok);
@ -323,7 +325,9 @@ def_union (definition *defp)
cases->case_name = tok.str;
scan (TOK_COLON, &tok);
/* now peek at next token */
#if 0
flag = 0;
#endif
if (peekscan (TOK_CASE, &tok))
{
@ -340,6 +344,7 @@ def_union (definition *defp)
}
while (peekscan (TOK_CASE, &tok));
}
#if 0
else if (flag)
{
@ -347,6 +352,7 @@ def_union (definition *defp)
tailp = &cases->next;
cases = ALLOC (case_list);
};
#endif
get_declaration (&dec, DEF_UNION);
cases->case_decl = dec;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -242,11 +242,15 @@ __gen_tempname (char *tmpl, int kind)
necessary to try all these combinations. Instead if a reasonable
number of names is tried (we define reasonable as 62**3) fail to
give the system administrator the chance to remove the problems. */
unsigned int attempts_min = 62 * 62 * 62;
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
conform to POSIX, this must be no smaller than TMP_MAX. */
unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min;
#if ATTEMPTS_MIN < TMP_MAX
unsigned int attempts = TMP_MAX;
#else
unsigned int attempts = ATTEMPTS_MIN;
#endif
len = strlen (tmpl);
if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX"))