Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern sys_connect(): fix the call to FILE_UNUSE() so that...



details:   https://anonhg.NetBSD.org/src/rev/e5653aac4d13
branches:  trunk
changeset: 511731:e5653aac4d13
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Jun 25 19:46:50 2001 +0000

description:
sys_connect(): fix the call to FILE_UNUSE() so that it's done on return, rather
        than immediatelly after getsock() call

diffstat:

 sys/kern/uipc_syscalls.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 6420e0442c66 -r e5653aac4d13 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Mon Jun 25 19:41:19 2001 +0000
+++ b/sys/kern/uipc_syscalls.c  Mon Jun 25 19:46:50 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.61 2001/06/25 19:24:03 jdolecek Exp $      */
+/*     $NetBSD: uipc_syscalls.c,v 1.62 2001/06/25 19:46:50 jdolecek Exp $      */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -270,19 +270,21 @@
        if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
                return (error);
        so = (struct socket *)fp->f_data;
-       FILE_UNUSE(fp, p);
-       if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING))
-               return (EALREADY);
+       if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
+               error = EALREADY;
+               goto out;
+       }
        error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen),
            MT_SONAME);
        if (error)
-               return (error);
+               goto out;
        error = soconnect(so, nam);
        if (error)
                goto bad;
        if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
                m_freem(nam);
-               return (EINPROGRESS);
+               error = EINPROGRESS;
+               goto out;
        }
        s = splsoftnet();
        while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
@@ -301,6 +303,8 @@
        m_freem(nam);
        if (error == ERESTART)
                error = EINTR;
+ out:
+       FILE_UNUSE(fp, p);
        return (error);
 }
 



Home | Main Index | Thread Index | Old Index