mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
af_iucv: Change if condition in sendmsg() for more readability
Change the if condition to exit sendmsg() if the socket in not connected. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cb2107be43
commit
bb664f49f8
1 changed files with 87 additions and 88 deletions
|
@ -747,7 +747,12 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (sk->sk_state == IUCV_CONNECTED) {
|
||||
/* Return if the socket is not in connected state */
|
||||
if (sk->sk_state != IUCV_CONNECTED) {
|
||||
err = -ENOTCONN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* initialize defaults */
|
||||
cmsg_done = 0; /* check for duplicate headers */
|
||||
txmsg.class = 0;
|
||||
|
@ -794,11 +799,10 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
|||
* this is fine for SOCK_SEQPACKET (unless we want to support
|
||||
* segmented records using the MSG_EOR flag), but
|
||||
* for SOCK_STREAM we might want to improve it in future */
|
||||
if (!(skb = sock_alloc_send_skb(sk, len,
|
||||
msg->msg_flags & MSG_DONTWAIT,
|
||||
&err)))
|
||||
skb = sock_alloc_send_skb(sk, len, msg->msg_flags & MSG_DONTWAIT,
|
||||
&err);
|
||||
if (!skb)
|
||||
goto out;
|
||||
|
||||
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
|
||||
err = -EFAULT;
|
||||
goto fail;
|
||||
|
@ -839,18 +843,13 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
|||
memcpy(appl_id, iucv->dst_name, 8);
|
||||
pr_err("Application %s on z/VM guest %s"
|
||||
" exceeds message limit\n",
|
||||
user_id, appl_id);
|
||||
appl_id, user_id);
|
||||
}
|
||||
skb_unlink(skb, &iucv->send_skb_q);
|
||||
err = -EPIPE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
} else {
|
||||
err = -ENOTCONN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
release_sock(sk);
|
||||
return len;
|
||||
|
||||
|
|
Loading…
Reference in a new issue