patch-2.1.30 linux/net/x25/af_x25.c

Next file: linux/net/x25/x25_dev.c
Previous file: linux/net/unix/af_unix.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.29/linux/net/x25/af_x25.c linux/net/x25/af_x25.c
@@ -352,21 +352,22 @@
 	char *optval, int optlen)
 {
 	struct sock *sk = sock->sk;
-	int err, opt;
+	int opt;
 
 	if (level != SOL_X25)
 		return -ENOPROTOOPT;
 
-	if(optlen<sizeof(int))
+	if (optlen < sizeof(int))
 		return-EINVAL;
-	if(get_user(opt, (int *)optval))
+
+	if (get_user(opt, (int *)optval))
 		return -EFAULT;
 
-	switch (optname) 
-	{
+	switch (optname) {
 		case X25_QBITINCL:
 			sk->protinfo.x25->qbitincl = opt ? 1 : 0;
 			return 0;
+
 		default:
 			return -ENOPROTOOPT;
 	}
@@ -382,11 +383,10 @@
 	if (level != SOL_X25)
 		return -ENOPROTOOPT;
 
-	if(get_user(len,optlen))
+	if (get_user(len, optlen))
 		return -EFAULT;
-		
-	switch (optname) 
-	{
+
+	switch (optname) {
 		case X25_QBITINCL:
 			val = sk->protinfo.x25->qbitincl;
 			break;
@@ -395,11 +395,14 @@
 			return -ENOPROTOOPT;
 	}
 
-	len=min(len,sizeof(int));
-	if(put_user(len, optlen))
+	len = min(len, sizeof(int));
+
+	if (put_user(len, optlen))
 		return -EFAULT;
-	if(copy_to_user(optval,&val,len))
+
+	if (copy_to_user(optval, &val, len))
 		return -EFAULT;
+
 	return 0;
 }
 

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected]