From: igor@9lab.org
To: 9front@9front.org
Cc: igor@9lab.org
Subject: [9front] [PATCH] tweak: add missing return to fix double close(…) on file descriptor…
Date: Wed, 06 Oct 2021 15:51:00 +0200 [thread overview]
Message-ID: <E7B9BF525194450C514FEF6D3260890B@9lab.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
The below patch adds a missing return statement to avoid a double close() on a file
descriptor and printing of conflicting messages where one says `can't write...`
followed by a `wrote ...` message.
Plumb the following for more context:
∙ /sys/src/cmd/tweak.c:/^twrite
∙ /sys/src/cmd/tweak.c:1730,1739
<snip>
From: Igor Böhm <igor@9lab.org>
Date: Wed, 06 Oct 2021 13:37:39 +0000
Subject: [PATCH] tweak: add missing return to fix double close(…) on file descriptor…
… and avoid printing conflicting messages.
---
diff 6ebb8b9e357944cc29ae3fafc0900ee3e325ed39 f9a20f83ad671a6404c42cc2bdfd4c9b1abceabc
--- a/sys/src/cmd/tweak.c Sun Oct 3 17:58:58 2021
+++ b/sys/src/cmd/tweak.c Wed Oct 6 15:37:39 2021
@@ -1731,6 +1731,7 @@
if(writeimage(fd, t->b, 0)<0 || (t->s && writesubfont(fd, t->s)<0)){
close(fd);
mesg("can't write %s: %r", t->name);
+ return;
}
t->mod = 0;
close(fd);
</snap>
Cheers,
Igor
[-- Attachment #2: tweak-missing-return.patch --]
[-- Type: text/plain, Size: 593 bytes --]
From: Igor Böhm <igor@9lab.org>
Date: Wed, 06 Oct 2021 13:37:39 +0000
Subject: [PATCH] tweak: add missing return to fix double close(…) on file descriptor…
… and avoid printing conflicting messages.
---
diff 6ebb8b9e357944cc29ae3fafc0900ee3e325ed39 f9a20f83ad671a6404c42cc2bdfd4c9b1abceabc
--- a/sys/src/cmd/tweak.c Sun Oct 3 17:58:58 2021
+++ b/sys/src/cmd/tweak.c Wed Oct 6 15:37:39 2021
@@ -1731,6 +1731,7 @@
if(writeimage(fd, t->b, 0)<0 || (t->s && writesubfont(fd, t->s)<0)){
close(fd);
mesg("can't write %s: %r", t->name);
+ return;
}
t->mod = 0;
close(fd);
reply other threads:[~2021-10-06 13:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E7B9BF525194450C514FEF6D3260890B@9lab.org \
--to=igor@9lab.org \
--cc=9front@9front.org \
/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;
as well as URLs for NNTP newsgroup(s).