Re: man 7 socket SO_INCOMING_CPU example typo

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

 



On 03/23/2018 08:23 AM, Salminen, Tomi wrote:
> Hi.
> 
> Me and Tommi Linnakangas at work noticed that there's a bug-inducing typo in the
> man 7 socket entry for SO_INCOMING_CPU:
> 
>                   int cpu = 1;
>                   socklen_t len = sizeof(cpu);
>                   setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, &len);
> 
> The len argument should not be a pointer to len, but value of len.

Thanks, Tomi. I applied the patch below.

Cheers,

Michael


diff --git a/man7/socket.7 b/man7/socket.7
index 89251eb12..b1aebfae2 100644
--- a/man7/socket.7
+++ b/man7/socket.7
@@ -499,8 +499,7 @@ Expects an integer flag.
 .in +4n
 .EX
 int cpu = 1;
-socklen_t len = sizeof(cpu);
-setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, &len);
+setsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, &cpu, sizeof(cpu));
 .EE
 .in
 .IP

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux