Re: [PATCH v2] tools/counter: Close fd when exit

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

 



On Wed, Sep 04, 2024 at 09:42:53AM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
> 
> Since fd is not used in the messaging it's better to 
> close it before printing anything. Ditto for other cases.
> 
> Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>

Hello zhang,

I appreciate you for submitting this patch. Before I can accept it, I
need to understand the reason for it.

Previously counter_example.c did call close() before returning, but as
David Laight pointed out, we removed it for being redundant when the
kernel closes file descriptors on exit, as well as possibly changing
errno before perror() and strerror() are called.

Is this patch made to address a particular bug you have discovered? I
would like to document the rationale for this change in the commit
message so we properly understand the reason for calling close() here.

Sincerely,

William Breathitt Gray

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux