summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-25 21:35:50 +0200
committerJim Meyering <meyering@redhat.com>2011-05-26 22:10:46 +0200
commita042bba6c7cfd8147d863927bfc9cc4d21852f43 (patch)
tree848ac24e6e4397e199824ef16ad25df541bfc8df
parent41139da2e774dd352ea4566d72f2f3818e0338e7 (diff)
downloadcoreutils-a042bba6c7cfd8147d863927bfc9cc4d21852f43.tar.xz
shred: placate coverity and fix a comment
* src/shred.c (incname): Add an assertion to tell static analyzers that we know this particular use of strchr never returns NULL. Finish incomplete sentence in function-describing comment.
-rw-r--r--src/shred.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shred.c b/src/shred.c
index d8b33e780..ecb27b851 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -907,9 +907,9 @@ static char const nameset[] =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.";
/* Increment NAME (with LEN bytes). NAME must be a big-endian base N
- number with the digits taken from nameset. Return true if
- successful if not (because NAME already has the greatest possible
- value. */
+ number with the digits taken from nameset. Return true if successful.
+ Otherwise, (because NAME already has the greatest possible value)
+ return false. */
static bool
incname (char *name, size_t len)
@@ -918,6 +918,10 @@ incname (char *name, size_t len)
{
char const *p = strchr (nameset, name[len]);
+ /* Given that NAME is composed of bytes from NAMESET,
+ P will never be NULL here. */
+ assert (p);
+
/* If this character has a successor, use it. */
if (p[1])
{