[PATCH] af_econet.c: s/suser/capable/ + micro cleanup

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Sun Aug 27 2000 - 09:50:41 EST


Hi,
        
        Please consider applying.

                        - Arnaldo

--- linux-2.4.0-test7/net/econet/af_econet.c Fri Jul 28 06:35:01 2000
+++ linux-2.4.0-test7.acme/net/econet/af_econet.c Sun Aug 27 11:48:00 2000
@@ -641,17 +641,15 @@
 static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
         struct sock *sk = sock->sk;
- int err;
         int pid;
 
         switch(cmd)
         {
                 case FIOSETOWN:
                 case SIOCSPGRP:
- err = get_user(pid, (int *) arg);
- if (err)
- return err;
- if (current->pid != pid && current->pgrp != -pid && !suser())
+ if (get_user(pid, (int *) arg))
+ return -EFAULT;
+ if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN))
                                 return -EPERM;
                         sk->proc = pid;
                         return(0);
@@ -661,10 +659,7 @@
                 case SIOCGSTAMP:
                         if(sk->stamp.tv_sec==0)
                                 return -ENOENT;
- err = -EFAULT;
- if (!copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)))
- err = 0;
- return err;
+ return copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)) ? -EFAULT : 0;
                 case SIOCGIFFLAGS:
                 case SIOCSIFFLAGS:
                 case SIOCGIFCONF:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:19 EST