Current-Users archive

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

Re: Problem cross building NetBSD under Mac OS X Snow Leopard



On Thu 12 Nov 2009 at 01:39:46 +0100, Rhialto wrote:
> The best way is probably to replace the use of id_t by uid_t and gid_t,
> and to duplicate the one function which uses id_t for either, or to use
> some temp variable at its call to store in the result.

Something like this seems to compile, but then I run into some other
detail that I overlooked previously.

Index: xinstall.c
===================================================================
RCS file: /cvsroot/src/usr.bin/xinstall/xinstall.c,v
retrieving revision 1.113
diff -u -r1.113 xinstall.c
--- xinstall.c  30 Oct 2009 20:57:30 -0000      1.113
+++ xinstall.c  12 Nov 2009 09:32:21 -0000
@@ -88,7 +88,8 @@
 int    numberedbackup;
 int    mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
 char   pathbuf[MAXPATHLEN];
-id_t   uid = -1, gid = -1;
+uid_t  uid = -1;
+gid_t  gid = -1;
 char   *group, *owner, *fflags, *tags;
 FILE   *metafp;
 char   *metafile;
@@ -312,14 +313,18 @@
 
        /* get group and owner id's */
        if (group && !dounpriv) {
-               if (gid_from_group(group, &gid) == -1 && ! parseid(group, &gid))
+               id_t id;
+               if (gid_from_group(group, &gid) == -1 && ! parseid(group, &id))
                        errx(1, "unknown group %s", group);
                iflags |= HASGID;
+               gid = id;
        }
        if (owner && !dounpriv) {
-               if (uid_from_user(owner, &uid) == -1 && ! parseid(owner, &uid))
+               id_t id;
+               if (uid_from_user(owner, &uid) == -1 && ! parseid(owner, &id))
                        errx(1, "unknown user %s", owner);
                iflags |= HASUID;
+               uid = id;
        }
 
 #if ! HAVE_NBTOOL_CONFIG_H

Now I'm left with this:

dependall ===> tools/binstall
     create  binstall/getid.d
     create  binstall/xinstall.d
     create  binstall/.depend
    compile  binstall/xinstall.lo
    compile  binstall/getid.lo
       link  binstall/xinstall
xinstall.lo(.text+0xde7): In function `do_symlink':
: warning: warning: mktemp() possibly used unsafely; consider using mkstemp()
/vol-fourquid-1/olafs/netbsd-git//work/obj.amd64/tools/compat/libnbcompat.a(sha2.lo)(.text+0xe8d):
 In function `SHA512_Final':
: undefined reference to `be64enc'
--- xinstall ---
*** [xinstall] Error code 1
1 error

nbmake: stopped in /tank/vol-fourquid-1/olafs/netbsd-git/cvs/src/tools/binstall

There is this in compat_defs.h but that wasn't changed recently, was it?

#define __GEN_ENDIAN_ENC(bits, endian) \
static void \
endian ## bits ## enc(void *dst, uint ## bits ## _t u) \
{ \
        u = hto ## endian ## bits (u); \
        memcpy(dst, &u, sizeof(u)); \
}
#if !HAVE_DECL_BE16ENC
__GEN_ENDIAN_ENC(16, be)
#endif
...

Configure says

checking whether be64enc is declared... yes

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index