On Sunday 06 March 2011 21:49, Tito wrote:
> On Sunday 06 March 2011 18:59:04 Denys Vlasenko wrote:
> > Should we try to retrieve current user's shell 
> > (getpwuid(getuid())->pw_shell)
> > before falling back to DEFAULT_SHELL?
> > 
> > In short, seems like we can create a helper function and use it in most
> > of these locations.
> > 
> > Care to prepare a patch?
> > 
> 
> On android there are no passwd/group files at all
> passwd and group structs are created on the fly
> from hardcoded values (for system ids) or from
> file uids/gids for installed apps

We don't _need_ passwd/group _files_.
We only need getpwuid(getuid()) to return a struct passwd*
whose ->pw_shell is meaningful.

> static struct passwd*
> android_iinfo_to_passwd( struct passwd          *pw,
>                          struct android_id_info *iinfo )
> {
>     pw->pw_name  = (char*)iinfo->name;
>     pw->pw_uid   = iinfo->aid;
>     pw->pw_gid   = iinfo->aid;
>     pw->pw_dir   = "/";
>     pw->pw_shell = "/system/bin/sh";
>     return pw;
> }

If this is a bit of code from android's libc, then it looks good:
it does what we need.

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to