Deleted Added
full compact
39c39
< * $FreeBSD: head/sys/security/mac/mac_pipe.c 104533 2002-10-05 18:40:10Z rwatson $
---
> * $FreeBSD: head/sys/security/mac/mac_pipe.c 104541 2002-10-05 21:23:47Z rwatson $
223a224,225
> static void mac_destroy_socket_label(struct label *label);
>
1159,1160c1161,1162
< void
< mac_init_socket(struct socket *socket)
---
> static int
> mac_init_socket_label(struct label *label, int flag)
1161a1164
> int error;
1163,1166c1166,1173
< mac_init_label(&socket->so_label);
< mac_init_label(&socket->so_peerlabel);
< MAC_PERFORM(init_socket_label, &socket->so_label);
< MAC_PERFORM(init_socket_peer_label, &socket->so_peerlabel);
---
> mac_init_label(label);
>
> MAC_CHECK(init_socket_label, label, flag);
> if (error) {
> MAC_PERFORM(destroy_socket_label, label);
> mac_destroy_label(label);
> }
>
1168c1175,1176
< atomic_add_int(&nmacsockets, 1);
---
> if (error == 0)
> atomic_add_int(&nmacsockets, 1);
1169a1178,1179
>
> return (error);
1171a1182,1213
> static int
> mac_init_socket_peer_label(struct label *label, int flag)
> {
> int error;
>
> mac_init_label(label);
>
> MAC_CHECK(init_socket_peer_label, label, flag);
> if (error) {
> MAC_PERFORM(destroy_socket_label, label);
> mac_destroy_label(label);
> }
>
> return (error);
> }
>
> int
> mac_init_socket(struct socket *socket, int flag)
> {
> int error;
>
> error = mac_init_socket_label(&socket->so_label, flag);
> if (error)
> return (error);
>
> error = mac_init_socket_peer_label(&socket->so_peerlabel, flag);
> if (error)
> mac_destroy_socket_label(&socket->so_label);
>
> return (error);
> }
>
1285,1286c1327,1328
< void
< mac_destroy_socket(struct socket *socket)
---
> static void
> mac_destroy_socket_label(struct label *label)
1289,1292c1331,1332
< MAC_PERFORM(destroy_socket_label, &socket->so_label);
< MAC_PERFORM(destroy_socket_peer_label, &socket->so_peerlabel);
< mac_destroy_label(&socket->so_label);
< mac_destroy_label(&socket->so_peerlabel);
---
> MAC_PERFORM(destroy_socket_label, label);
> mac_destroy_label(label);
1298a1339,1354
> mac_destroy_socket_peer_label(struct label *label)
> {
>
> MAC_PERFORM(destroy_socket_peer_label, label);
> mac_destroy_label(label);
> }
>
> void
> mac_destroy_socket(struct socket *socket)
> {
>
> mac_destroy_socket_label(&socket->so_label);
> mac_destroy_socket_peer_label(&socket->so_peerlabel);
> }
>
> static void