[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zvkl02bt6TPb2G_H@ishi>
Date: Sun, 29 Sep 2024 19:02:59 +0900
From: William Breathitt Gray <wbg@...nel.org>
To: zhangjiao2 <zhangjiao2@...s.chinamobile.com>
Cc: andy.shevchenko@...il.com, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org,
David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH v2] tools/counter: Close fd when exit
On Wed, Sep 04, 2024 at 09:42:53AM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@...s.chinamobile.com>
>
> 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@...s.chinamobile.com>
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
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists