bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI, placating valgrind, wrt ./cp --sparse=always


From: Jim Meyering
Subject: FYI, placating valgrind, wrt ./cp --sparse=always
Date: Thu, 22 Feb 2007 12:52:26 +0100

I've just checked in this change:

        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.

diff --git a/src/copy.c b/src/copy.c
index a3489c3..f0c6539 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.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]