From glibc-2.2.x to glibc-2.3.x

Grant Leslie grantl at nbnet.nb.ca
Sat Oct 26 14:11:24 PDT 2002


Greg Schafer wrote:
> But in our case, it has the unfortunate side effect of breaking
> "statically
> linked getpwuid() using binaries that are compiled and linked
> against a glibc
> less than or equal to 2.2.5 when run on a glibc-2.3 system for
> eg: bash, ls,
> tar, install, etc"    Whew, that was a mouthful :)

If it's only getpwuid(), how ugly a hack ( and would it work? ) would
something like this be?
linked with LDFLAGS="-lmygetpwuid" to static binaries that use getpwuid() so
as to avoid linking against the getpwuid() which will call the nss libraries
later?
( Please forgive the gross programming errors, just a quick write to
illustrate of what I mean, not meant to work as is. )

#include <pwd.h>

#undef getpwuid

struct passwd *getpwuid (__uid_t id)
{
        struct passwd my_passwd;

        my_passwd.pwname="root";
        my_passwd.pw_passwd="x";
        my_passwd.pw_uid=0;
        my_passwd.pw_gid=0;
        my_passwd.pw_gecos="root";
        my_passwd.pw_dir="/root";
        my_passwd.pw_shell="/bin/sh";

        return my_passwd;
}



-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list