[PATCH] chown user: w/o group

Tito farmatito at tiscali.it
Fri Sep 22 19:55:45 UTC 2006


On Friday 22 September 2006 21:45, Luciano Miguel Ferreira Rocha wrote:
> On Fri, Sep 22, 2006 at 09:37:07PM +0200, Tito wrote:
> > 
> > Hi,
> > can i suggest to change this name to something less cryptic
> 
> Sure. I was just out of ideas.
> 
> > BTW: Is it really necessary to create a new function for this task?
> > Maybe something like this could be enough?
> > 
> > 	if (uname) {
> > 		if (uname[0] !='\0')
> > 			uid = bb_xgetpwnam(uname);
> > 		else
> > 			uid = getuid();
> > 	}
> > 	if (gname) {
> > 		if (gname[0] !='\0')
> > 			gid = bb_xgetgrnam(gname);
> > 		else 
> > 			gid = getgid();
> > 	}
> > 
> > This is just a hint and is fully untested.
> 
> No. The point isn't in using the process's uid and gid.

Ops, I see.

> With the format:
> 
> chown <newuser>:<newgroup> <files> ...
> 
> If <newgroup> is empty, and <newuser> isn't, then get the passwd entry
> for <newuser> and use its default group.
> 
> It isn't necessary to create a new function, I could put that code in
> the chown applet. But this way it simplified the applet and make the
> funcionality available as a function for other applets.
> 

Can you think of some other applet that could need this kind of
funcionality?
If yes it is a good idea to put it in libbb else
it should better go in the applet itself.

Just my opinion.

Ciao,
Tito 



More information about the busybox mailing list