From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 29536 invoked from network); 6 Oct 2021 13:59:15 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 6 Oct 2021 13:59:15 -0000 Received: from mail.9lab.org ([168.119.8.41]) by 4ess; Wed Oct 6 09:53:39 -0400 2021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9lab.org; s=20210803; t=1633528402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=g9D5NylUzlQ7ZWes/kQ72GL0AEoX4X9w9aB0MjafrUA=; b=TY6wER2O3Gv7iNdxenu4lZ/9O/ETNJM2cZWM4MyWj2Y+CWLvHk/wXn4ATToauzBPav7YnR /sKnhVt39pE1Cw9AcOuKGJ0YI8cMRvx302XeL6R5+HB/72eiwZ1vkOcSBvX+JZ0NbC6pO6 4E1EgYhAuknB6QaCdY1u+rgEd9qFy4c= Received: from pjw (host-185-64-155-70.ecsnet.at [185.64.155.70]) by mail.9lab.org (OpenSMTPD) with ESMTPSA id 8c1c93d8 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO); Wed, 6 Oct 2021 15:53:22 +0200 (CEST) Message-ID: To: 9front@9front.org CC: igor@9lab.org Date: Wed, 06 Oct 2021 15:51:00 +0200 From: igor@9lab.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-fpfqiabyheerpfejvsmhnkbriv" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: proven callback blockchain table-oriented framework Subject: [9front] =?utf-8?q?[PATCH]_tweak:_add_missing_return_to_fix_double_close(=E2=80=A6)_on_file_descriptor=E2=80=A6?= Reply-To: 9front@9front.org Precedence: bulk This is a multi-part message in MIME format. --upas-fpfqiabyheerpfejvsmhnkbriv Content-Disposition: inline Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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 From: Igor Böhm 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); Cheers, Igor --upas-fpfqiabyheerpfejvsmhnkbriv Content-Disposition: attachment; filename=tweak-missing-return.patch Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit From: Igor Böhm 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); --upas-fpfqiabyheerpfejvsmhnkbriv--