Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bcb5e0eef35059af372a7bd3fc68915278d74bc0
Commit:     bcb5e0eef35059af372a7bd3fc68915278d74bc0
Parent:     172589ccdde41b59861c92c4a971b95514ef24e3
Author:     Samuel Ortiz <[EMAIL PROTECTED]>
AuthorDate: Tue Aug 28 15:57:12 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:48:37 2007 -0700

    [IrDA]: MSG_NOSIGNAL support for IrDA sockets
    
    Signed-off-by: Samuel Ortiz <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/irda/af_irda.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 4c670cf..c80949a 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1245,18 +1245,17 @@ static int irda_sendmsg(struct kiocb *iocb, struct 
socket *sock,
        struct sock *sk = sock->sk;
        struct irda_sock *self;
        struct sk_buff *skb;
-       int err;
+       int err = -EPIPE;
 
        IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
 
        /* Note : socket.c set MSG_EOR on SEQPACKET sockets */
-       if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
+       if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT |
+                              MSG_NOSIGNAL))
                return -EINVAL;
 
-       if (sk->sk_shutdown & SEND_SHUTDOWN) {
-               send_sig(SIGPIPE, current, 0);
-               return -EPIPE;
-       }
+       if (sk->sk_shutdown & SEND_SHUTDOWN)
+               goto out_err;
 
        if (sk->sk_state != TCP_ESTABLISHED)
                return -ENOTCONN;
@@ -1283,7 +1282,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket 
*sock,
        skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16,
                                  msg->msg_flags & MSG_DONTWAIT, &err);
        if (!skb)
-               return -ENOBUFS;
+               goto out_err;
 
        skb_reserve(skb, self->max_header_size + 16);
        skb_reset_transport_header(skb);
@@ -1291,7 +1290,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket 
*sock,
        err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
        if (err) {
                kfree_skb(skb);
-               return err;
+               goto out_err;
        }
 
        /*
@@ -1301,10 +1300,14 @@ static int irda_sendmsg(struct kiocb *iocb, struct 
socket *sock,
        err = irttp_data_request(self->tsap, skb);
        if (err) {
                IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err);
-               return err;
+               goto out_err;
        }
        /* Tell client how much data we actually sent */
        return len;
+
+ out_err:
+       return sk_stream_error(sk, msg->msg_flags, err);
+
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to