Re: [PATCH] fanotify.3: Pass array to read(2) directly instead of a pointer to it

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

 



On 9/5/20 1:42 PM, Alejandro Colomar wrote:
> Hi Michael,
> 
> I had a typo in the subject.  It's fanotify.7; please fix it when
> applying the patch.

Patch applied. and title line fixed.

Thanks, Alex.

Cheers,

Michael

> On 9/5/20 1:28 PM, Alejandro Colomar wrote:
>> It doesn't make any sense to pass a pointer to the array to read(2).
>>
>> It might make sense to pass a pointer to the first element of the array,
>> but that is already implicitly done when passing the array, which decays
>> to that pointer, so it's simpler to pass the array.
>>
>> And anyway, the cast was unneeded, as any pointer is implicitly casted
>> to `void *`.
>>
>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
>> ---
>>  man7/fanotify.7 | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/man7/fanotify.7 b/man7/fanotify.7
>> index c18ab68ed..c3d40b56d 100644
>> --- a/man7/fanotify.7
>> +++ b/man7/fanotify.7
>> @@ -818,7 +818,7 @@ handle_events(int fd)
>>  
>>          /* Read some events */
>>  
>> -        len = read(fd, (void *) &buf, sizeof(buf));
>> +        len = read(fd, buf, sizeof(buf));
>>          if (len == \-1 && errno != EAGAIN) {
>>              perror("read");
>>              exit(EXIT_FAILURE);
>> @@ -1111,7 +1111,7 @@ main(int argc, char **argv)
>>  
>>      /* Read events from the event queue into a buffer */
>>  
>> -    len = read(fd, (void *) &events_buf, sizeof(events_buf));
>> +    len = read(fd, events_buf, sizeof(events_buf));
>>      if (len == \-1 && errno != EAGAIN) {
>>          perror("read");
>>          exit(EXIT_FAILURE);
>>


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[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