[apparmor] [PATCH 1/4] tests: Don't leak socket fd to child process
Seth Arnold
seth.arnold at canonical.com
Tue Aug 12 00:29:35 UTC 2014
On Mon, Aug 11, 2014 at 03:08:09PM -0500, Tyler Hicks wrote:
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: Seth Arnold <seth.arnold at canonical.com>
Thanks
> ---
> tests/regression/apparmor/unix_socket_file.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/regression/apparmor/unix_socket_file.c b/tests/regression/apparmor/unix_socket_file.c
> index a24e84e..76a4eb8 100644
> --- a/tests/regression/apparmor/unix_socket_file.c
> +++ b/tests/regression/apparmor/unix_socket_file.c
> @@ -116,7 +116,7 @@ int main (int argc, char *argv[])
> }
> memcpy(msg_buf, argv[3], msg_buf_len);
>
> - sock = socket(AF_UNIX, type, 0);
> + sock = socket(AF_UNIX, type | SOCK_CLOEXEC, 0);
> if (sock == -1) {
> perror("FAIL - socket");
> exit(1);
> @@ -131,7 +131,7 @@ int main (int argc, char *argv[])
> exit(1);
> }
>
> - if (type == SOCK_STREAM || type == SOCK_SEQPACKET) {
> + if (type & SOCK_STREAM || type & SOCK_SEQPACKET) {
> rc = listen(sock, 2);
> if (rc < 0) {
> perror("FAIL - listen");
> @@ -159,7 +159,7 @@ int main (int argc, char *argv[])
> exit(1);
> }
>
> - rc = (type == SOCK_STREAM || type == SOCK_SEQPACKET) ?
> + rc = (type & SOCK_STREAM || type & SOCK_SEQPACKET) ?
> connection_based_messaging(sock, msg_buf, msg_buf_len) :
> connectionless_messaging(sock, msg_buf, msg_buf_len);
> if (rc)
> --
> 2.1.0.rc1
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140811/1f5ed1c2/attachment.pgp>
More information about the AppArmor
mailing list