[LTP] [PATCH v2 1/8] Rewrite userns01.c using new LTP API

Andrea Cervesato andrea.cervesato@suse.com
Fri Mar 25 10:18:11 CET 2022


Hi Petr,

On 3/24/22 21:50, Petr Vorel wrote:
> Hi Andrea,
>
> ...
>> +static inline void updatemap(int cpid, bool type, int idnum, int parentmappid)
> nit: This header should #include <stdbool.h>, not all tests (they use UID_MAP,
> thus they don't need it).
I think this will be replaced with integer, according also with the 
if/else statement which is below and use switch to check its value as well.
> Kind regards,
> Petr
>
>> +{
>> +	char path[BUFSIZ];
>> +	char content[BUFSIZ];
>> +	int fd;
>> +
>> +	if (type == UID_MAP)
>> +		sprintf(path, "/proc/%d/uid_map", cpid);
>> +	else if (type == GID_MAP)
>> +		sprintf(path, "/proc/%d/gid_map", cpid);
>> +	else
>> +		tst_brk(TBROK, "invalid type parameter");
>> +
>> +	sprintf(content, "%d %d 1", idnum, parentmappid);
>> +
>> +	fd = SAFE_OPEN(path, O_WRONLY, 0644);
>> +	SAFE_WRITE(1, fd, content, strlen(content));
>> +	SAFE_CLOSE(fd);
>> +}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220325/bcb0dd87/attachment.htm>


More information about the ltp mailing list