aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-04-07 20:25:36 +0000
committerUlrich Drepper <drepper@redhat.com>2006-04-07 20:25:36 +0000
commitcec4091671724d867d1bc80c37be9f50f572c8f7 (patch)
treebf605e22619cbbb365d4db0077084670fe9090ad
parent2035d91c389888fcf359698fecc20c05f7b583dd (diff)
downloadglibc-cec4091671724d867d1bc80c37be9f50f572c8f7.tar
glibc-cec4091671724d867d1bc80c37be9f50f572c8f7.tar.gz
glibc-cec4091671724d867d1bc80c37be9f50f572c8f7.tar.bz2
glibc-cec4091671724d867d1bc80c37be9f50f572c8f7.zip
* 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].
-rw-r--r--ChangeLog27
-rw-r--r--inet/inet6_option.c6
-rw-r--r--io/fts.c8
-rw-r--r--locale/programs/ld-numeric.c23
-rw-r--r--locale/programs/linereader.c8
-rw-r--r--misc/tsearch.c11
-rw-r--r--sunrpc/rpc_parse.c6
-rw-r--r--sysdeps/posix/tempname.c10
8 files changed, 65 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index d666ae3fb2..e9b36e03be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/inet/inet6_option.c b/inet/inet6_option.c
index 2e0fed8a30..f88982e323 100644
--- a/inet/inet6_option.c
+++ b/inet/inet6_option.c
@@ -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
diff --git a/io/fts.c b/io/fts.c
index 39c076a2c8..71400d1716 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -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)
diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c
index a101a402f4..a901c4d985 100644
--- a/locale/programs/ld-numeric.c
+++ b/locale/programs/ld-numeric.c
@@ -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';
- }
+ 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';
+ 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,13 +349,10 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result,
if (now->tok != tok_eol)
goto err_label;
- if (!ignore_content)
- {
- grouping[act++] = '\0';
+ grouping[act++] = '\0';
- numeric->grouping = xrealloc (grouping, act);
- numeric->grouping_len = act;
- }
+ numeric->grouping = xrealloc (grouping, act);
+ numeric->grouping_len = act;
}
break;
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index 1d3e60f69f..6587f7305b 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.c
@@ -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;
diff --git a/misc/tsearch.c b/misc/tsearch.c
index 7c3a0aaa78..5ba244b015 100644
--- a/misc/tsearch.c
+++ b/misc/tsearch.c
@@ -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);
}
- 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;
}
diff --git a/sunrpc/rpc_parse.c b/sunrpc/rpc_parse.c
index 9678f28140..f66538701f 100644
--- a/sunrpc/rpc_parse.c
+++ b/sunrpc/rpc_parse.c
@@ -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;
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 0d4bbc418a..c8973a0852 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -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"))