summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-02-22 12:50:36 +0100
committerJim Meyering <jim@meyering.net>2007-02-22 12:50:36 +0100
commitf48ca7f500cd55e88f9fa24ec8ef74d6bed25a69 (patch)
tree3abd7bb057a3d90e6ae420e390f21952b418c944
parentc25841e0d4335e220d244c141f3156c0f8139c86 (diff)
downloadcoreutils-f48ca7f500cd55e88f9fa24ec8ef74d6bed25a69.tar.xz
Placate valgrind, wrt ./cp --sparse=always
* src/copy.c (copy_reg): Place the sentinel by setting a full word's worth of bits, not just a single byte's worth. This avoids a harmless (but distracting) case of memory being used-uninitialized.
-rw-r--r--ChangeLog8
-rw-r--r--src/copy.c3
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d0d0fda94..ec598a011 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-02-22 Jim Meyering <jim@meyering.net>
+
+ Placate valgrind, wrt ./cp --sparse=always
+ * src/copy.c (copy_reg): Place the sentinel by setting a
+ full word's worth of bits, not just a single byte's worth.
+ This avoids a harmless (but distracting) case of memory being
+ used-uninitialized.
+
2007-02-21 Jim Meyering <jim@meyering.net>
* tests/misc/date: Remove vestigial use of Data::Dumper.
diff --git a/src/copy.c b/src/copy.c
index a3489c399..f0c6539b7 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -430,7 +430,8 @@ copy_reg (char const *src_name, char const *dst_name,
{
char *cp;
- buf[n_read] = 1; /* Sentinel to stop loop. */
+ wp = (word *) (buf + n_read);
+ *wp = 1; /* Sentinel to stop loop. */
/* Find first nonzero *word*, or the word with the sentinel. */