>>>Looks good to me (although the patch is mixed in with a bunch
>>>of other crud).  I've tested it out locally and will commit it
>>>unless there are any objections.
>>      it is because of cvs issue.  the important portion is below.
>       oops, need some change in uipc_syscalls.c side... hold on.

        this diff is taken against 4.2-RELEASE (in kame tree), sorry.
        also i need to say that i ran no tests (i have no environment).

        uipc_syscalls.c change: make very sure to nuke file descriptor on errors
        uipc_socket.c change: return ECONNABORTED

itojun


Index: kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/kame/kame/freebsd4/sys/kern/uipc_socket.c,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kern/uipc_socket.c  2001/01/19 02:25:59     1.1.1.3
+++ kern/uipc_socket.c  2001/02/08 01:37:42     1.3
@@ -362,7 +362,7 @@
        else {
                if (nam)
                        *nam = 0;
-               error = 0;
+               error = ECONNABORTED;
        }
        splx(s);
        return (error);
Index: kern/uipc_syscalls.c
===================================================================
RCS file: /cvsroot/kame/kame/freebsd4/sys/kern/uipc_syscalls.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -r1.1.1.3 -r1.2
--- kern/uipc_syscalls.c        2001/01/19 02:26:00     1.1.1.3
+++ kern/uipc_syscalls.c        2001/02/08 01:37:42     1.2
@@ -270,28 +270,22 @@
        fp->f_ops = &socketops;
        fp->f_type = DTYPE_SOCKET;
        sa = 0;
-       (void) soaccept(so, &sa);
-       if (sa == 0) {
-               namelen = 0;
-               if (uap->name)
-                       goto gotnoname;
-               splx(s);
-               return 0;
-       }
-       if (uap->name) {
+       error = soaccept(so, &sa);
+       if (!error && uap->name) {
                /* check sa_len before it is destroyed */
-               if (namelen > sa->sa_len)
-                       namelen = sa->sa_len;
+               if (sa) {
+                       if (namelen > sa->sa_len)
+                               namelen = sa->sa_len;
 #ifdef COMPAT_OLDSOCK
-               if (compat)
-                       ((struct osockaddr *)sa)->sa_family =
-                           sa->sa_family;
+                       if (compat)
+                               ((struct osockaddr *)sa)->sa_family =
+                                   sa->sa_family;
 #endif
-               error = copyout(sa, (caddr_t)uap->name, (u_int)namelen);
-               if (!error)
-gotnoname:
-                       error = copyout((caddr_t)&namelen,
-                           (caddr_t)uap->anamelen, sizeof (*uap->anamelen));
+                       error = copyout(sa, (caddr_t)uap->name, (u_int)namelen);
+               } else
+                       namelen = 0;
+               error = copyout((caddr_t)&namelen,
+                   (caddr_t)uap->anamelen, sizeof (*uap->anamelen));
        }
        if (sa)
                FREE(sa, M_SONAME);


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to