[LTP] [PATCH] syscalls/setregid02: Fix retrieving a group of user "nobody"

Yuriy Kolerov Yuriy.Kolerov@synopsys.com
Tue Oct 6 15:38:42 CEST 2015


Hi Cyril.

Yes, it would be wise. I'll do it in the second version of patch.

Regards,
Yuriy Kolerov


> -----Original Message-----
> From: Cyril Hrubis [mailto:chrubis@suse.cz]
> Sent: Monday, October 05, 2015 6:47 PM
> To: Yuriy Kolerov
> Cc: ltp@lists.linux.it; Vineet.Gupta1@synopsys.com;
> Alexey.Brodkin@synopsys.com; Anton.Kolesov@synopsys.com;
> Francois.Bedard@synopsys.com
> Subject: Re: [LTP] [PATCH] syscalls/setregid02: Fix retrieving a group of user
> "nobody"
> 
> Hi!
> > -#define GET_GID(group)	do {		\
> > +#define GET_GROUP_BY_NAME(group)	do {		\
> >  	junk = getgrnam(#group);	\
> >  	if (junk == NULL) {		\
> >  		tst_brkm(TBROK|TERRNO, NULL, "getgrnam(\"%s\") failed",
> #group); \
> > @@ -156,9 +156,18 @@ static void setup(void)
> >  	group = *(junk); \
> >  } while (0)
> >
> > -	GET_GID(root);
> > -	GET_GID(nobody);
> > -	GET_GID(bin);
> > +#define GET_GROUP_BY_GID(group, gid)	do {		\
> > +	junk = getgrgid(gid);	\
> > +	if (junk == NULL) {		\
> > +		tst_brkm(TBROK|TERRNO, NULL, "getgrgid(\"%d\") failed",
> gid); \
> > +	}				\
> > +	GID16_CHECK(junk->gr_gid, setregid, NULL); \
> > +	group = *(junk); \
> > +} while (0)
> 
> 
> Can we please get rid of the ugly macros and write them as functions
> instead?
> 
> Othewise it looks good to me.
> 
> --
> Cyril Hrubis
> chrubis@suse.cz


More information about the Ltp mailing list