[LTP] [PATCH v2 2/5] tst_safe_macros: add SAFE_GETGRGID()

Cyril Hrubis chrubis@suse.cz
Wed Oct 3 09:46:23 CEST 2018


Hi!
> >> +	rval = getgrgid(gid);
> >> +	if (rval == NULL) {
> >> +		tst_brk_(file, lineno, TBROK | TERRNO,
> >> +			"getgrgid(%li) failed", (long)gid);
> >> +	}
> > 
> > I also wonder if it's okay to break the test in case that the entry
> > wasn't found (the return value would be NULL and errno would be
> > untouched) but I guess that it's OK for most of the cases.
> 
> I think so too. Also I thought these safe_* functions are more for
> setting up the test, where it is more likely requesting existing groups.
> 
> Maybe for the fallback approach it could be handy. But if we really need
> more then two options, I think passing a array would do it.
> Or should we go with an array now?

Unless there is a case for it I woudln't bother at this point.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list