Saw 'error = ifioctl(); return error;' which I did not fold when removing
the lock around the call back then.

That should be simplified, but the variable could be dropped completely.
Or is it likely to be used in future versions of this function?

Index: kern/sys_socket.c
===================================================================
RCS file: /cvs/src/sys/kern/sys_socket.c,v
retrieving revision 1.60
diff -u -p -r1.60 sys_socket.c
--- kern/sys_socket.c   22 Jan 2023 12:05:44 -0000      1.60
+++ kern/sys_socket.c   14 Apr 2023 21:55:24 -0000
@@ -83,7 +83,6 @@ int
 soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p)
 {
        struct socket *so = (struct socket *)fp->f_data;
-       int error = 0;
 
        switch (cmd) {
 
@@ -109,7 +108,7 @@ soo_ioctl(struct file *fp, u_long cmd, c
        case FIOSETOWN:
        case SIOCSPGRP:
        case TIOCSPGRP:
-               error = sigio_setown(&so->so_sigio, cmd, data);
+               return sigio_setown(&so->so_sigio, cmd, data);
                break;
 
        case FIOGETOWN:
@@ -128,17 +127,14 @@ soo_ioctl(struct file *fp, u_long cmd, c
                 * interface and routing ioctls should have a
                 * different entry since a socket's unnecessary
                 */
-               if (IOCGROUP(cmd) == 'i') {
-                       error = ifioctl(so, cmd, data, p);
-                       return (error);
-               }
+               if (IOCGROUP(cmd) == 'i')
+                       return ifioctl(so, cmd, data, p);
                if (IOCGROUP(cmd) == 'r')
                        return (EOPNOTSUPP);
-               error = pru_control(so, cmd, data, NULL);
-               break;
+               return pru_control(so, cmd, data, NULL);
        }
 
-       return (error);
+       return (0);
 }
 
 int

Reply via email to