Port-sparc archive

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

Re: Problems with packages on a netbsd-6 sparc



I had a look: as Eduardo suggested, the memcpy is inlined as a struct
copy. The code is lying (by using bogus casts), and the compiler is
correct in its optimization.

This patch avoids the lie about the memcpy() args to the compiler,
but I have not tested it further:

--- pwutil.c.orig       2011-10-21 15:18:38.000000000 +0200
+++ pwutil.c    2012-05-02 18:09:37.000000000 +0200
@@ -174,8 +174,8 @@
      * Copy in passwd contents and make strings relative to space
      * at the end of the buffer.
      */
+    memcpy(cp, pw, sizeof(struct passwd));
     newpw = (struct passwd *) cp;
-    memcpy(newpw, pw, sizeof(struct passwd));
     cp += sizeof(struct passwd);
     FIELD_COPY(pw, newpw, pw_name, nsize);
     FIELD_COPY(pw, newpw, pw_passwd, psize);

Martin


Home | Main Index | Thread Index | Old Index