<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><font size="4">Hi Petr,</font><br>
</p>
<div class="moz-cite-prefix">On 3/24/22 21:50, Petr Vorel wrote:<br>
</div>
<blockquote type="cite" cite="mid:YjzZnkrugQyEuWLe@pevik">
<pre class="moz-quote-pre" wrap="">Hi Andrea,
...
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">+static inline void updatemap(int cpid, bool type, int idnum, int parentmappid)
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">nit: This header should #include <stdbool.h>, not all tests (they use UID_MAP,
thus they don't need it).
</pre>
</blockquote>
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.<br>
<blockquote type="cite" cite="mid:YjzZnkrugQyEuWLe@pevik">
<pre class="moz-quote-pre" wrap="">
Kind regards,
Petr
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">+{
+ 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);
+}
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</body>
</html>