[PATCH] Implement decoding of NS_* ioctl commands

Dmitry V. Levin ldv at altlinux.org
Thu Apr 13 15:58:00 UTC 2017


On Thu, Apr 13, 2017 at 10:10:11PM +0700, Nikolay Marchuk wrote:
[...]
> --- a/NEWS
> +++ b/NEWS
> @@ -19,6 +19,7 @@ Noteworthy changes in release ?.?? (????-??-??)
>      architectures.
>    * Implemented decoding of statx syscall.
>    * Updated lists of ioctl commands from Linux 4.11.
> +  * Implemented decoding of NS_* ioctl commands.

I prefer "Implemented" news to be listed before "Updated".

[...]
> +static void
> +test_user_namespace(void)
> +{
> +	pid_t pid;
> +	int pipefd[2];
> +	int rc, status;
> +
> +	rc = pipe(pipefd);
> +	if (rc == -1)
> +		perror_msg_and_fail("pipe");

I don't see why do you need rc here, the same could be written as

	if (pipe(pipefd))
		perror_msg_and_fail("pipe");

> +	pid = clone(child, tail_alloc(1) + 1,
> +	            CLONE_NEWUSER | CLONE_UNTRACED | SIGCHLD, pipefd);
> +	if (pid == -1) {
> +		perror("clone");
> +		return;
> +	}
> +	close(pipefd[0]);
> +	test_clone(pid);
> +	close(pipefd[1]);
> +	if (wait(&status) != pid) {
> +		perror_msg_and_fail("wait");
> +	} else if (status != 0){

Please put a space between ) and {.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20170413/9bda76f9/attachment.bin>


More information about the Strace-devel mailing list