Linux IIO development
 help / color / mirror / Atom feed
From: William Breathitt Gray <wbg@kernel.org>
To: zhangjiao2 <zhangjiao2@cmss.chinamobile.com>
Cc: andy.shevchenko@gmail.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	David Laight <David.Laight@aculab.com>
Subject: Re: [PATCH v2] tools/counter: Close fd when exit
Date: Sun, 29 Sep 2024 19:02:59 +0900	[thread overview]
Message-ID: <Zvkl02bt6TPb2G_H@ishi> (raw)
In-Reply-To: <20240904014253.2435-1-zhangjiao2@cmss.chinamobile.com>

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

On Wed, Sep 04, 2024 at 09:42:53AM +0800, zhangjiao2 wrote:
> From: zhang jiao <zhangjiao2@cmss.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@cmss.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      parent reply	other threads:[~2024-09-29 10:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  1:42 [PATCH v2] tools/counter: Close fd when exit zhangjiao2
2024-09-04  7:35 ` Andy Shevchenko
2024-09-29 10:02 ` William Breathitt Gray [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zvkl02bt6TPb2G_H@ishi \
    --to=wbg@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhangjiao2@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox