From nobody Fri Sep 9 17:02:25 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MPMjt17kfz4bs4J; Fri, 9 Sep 2022 17:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MPMjt0Jmzz47gP; Fri, 9 Sep 2022 17:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662742946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J+1zq1W8W8DfptYQ9298pdRKtv5XDH3jy89IcGuf59Y=; b=egSqy7Ha5+X8zLrIZkexkGBEuTSY0EIxVL2aXKK+Dmyu/Y7DvRyLyiggobKA3Ih+rIempw 9ZVwA3PW8ZT3+/5sa068yaum7IYokMSeHIbjymrtNE3TjhflhKGEaUBwrTlkUAesTfAj4P XfBkcvgukjX1I046Ofe0MiQDEcgDlxXmyRvncv1FgfSYF6tX/vBI0ggbHB4WqMjr3sN7Bb 5+R4CoZ+BKrlUN3EDVc++heQGXhir8pfN1zJJRMmz1cEtRg46akBB7JZZhOdSgaknY1nYk +uLsMeBLzr9VMU5z550Rygdc9dzaB+wiS4Cy8w31TJimPGp7H/YaF9GlJ6apmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MPMjs606Zz1GtV; Fri, 9 Sep 2022 17:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 289H2Pko033043; Fri, 9 Sep 2022 17:02:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 289H2Phn033042; Fri, 9 Sep 2022 17:02:25 GMT (envelope-from git) Date: Fri, 9 Sep 2022 17:02:25 GMT Message-Id: <202209091702.289H2Phn033042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2a92854d81a1 - stable/13 - libc/stdio: only roll FILE state back on EINTR List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2a92854d81a10f02a8e244fe0ea449104bda5400 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662742946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J+1zq1W8W8DfptYQ9298pdRKtv5XDH3jy89IcGuf59Y=; b=Z8IEWFzvcZ5FRnOttpCK8QoobJ+p/eije3RkMuXHJsWOrf1jWidL/Qr2EVKYmVmOk4LVad qjGWgENn7UqgcOVpmkk18TWmyO3rfD2GcwtOQol+PKyj4UVwgjTpmzvESSt+cqarQPmBGO w3LPyvD14Dp1keRc1nohe/p1IDEBpgYkiXxiCUTp5zSxdnRe0tY2D5qYz8YznaRoapZt/G rORj/3Xi1wBYvSoaJOGkO1WgzAocwa2Dx3+QqK9/K9T4KqwnO0LAPpeUHqVqKcei99eNxX xaPlvL3WoAwzv21D/qZR2neeH/78ViTe+y+V1gYLQJc5MCjfBpSu2+ltouDqQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662742946; a=rsa-sha256; cv=none; b=aCdDuv9V2QsKg5lV/JpSixye46HzX27y+5SHqJJbN3Kj2o3lRgISeddJ8XFRREMOkgoLk/ CXqVGWLkU5NiswLH3ZAyokhrhIbN9ifMmteOiFmh7B2XvU7TzC/e5ct82z/fm5w1WU3xYn o4EF2D/NDgTH/LER3fSo4SYibkBClAeQcde4LjChXLbeKQdXFmVBTia9Ci82eHvfoGQ/kJ g79+AT9Pc3Q7w8W+kmtXqAN4sC1XWg/A4kC5SKHjsVAVM3fiAqyRAujpTPvL0M0hzkiM2F N3+oVJUG7LGyR3UYte8RAPdK237M/5DKNHTdsJXQcFepjOQPZcnkbXOLs9CIlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2a92854d81a10f02a8e244fe0ea449104bda5400 commit 2a92854d81a10f02a8e244fe0ea449104bda5400 Author: Konstantin Belousov AuthorDate: 2022-09-02 13:39:38 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-09 17:01:53 +0000 libc/stdio: only roll FILE state back on EINTR PR: 266171 (cherry picked from commit 44cf1e5eb470380442fa8e240e213a71b8fe81d4) --- lib/libc/stdio/fflush.c | 3 ++- lib/libc/stdio/fvwrite.c | 5 +++-- lib/libc/stdio/wbuf.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c index decc974907f4..f59565abd369 100644 --- a/lib/libc/stdio/fflush.c +++ b/lib/libc/stdio/fflush.c @@ -136,7 +136,8 @@ __sflush(FILE *fp) fp->_p += n; if ((fp->_flags & (__SLBF | __SNBF)) == 0) fp->_w -= n; - } else if (p == fp->_p) { /* cond. to handle setvbuf */ + /* conditional to handle setvbuf */ + } else if (p == fp->_p && errno == EINTR) { fp->_p = old_p; fp->_w = old_w; } diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index 2a161859afa9..b1b363e6f80d 100644 --- a/lib/libc/stdio/fvwrite.c +++ b/lib/libc/stdio/fvwrite.c @@ -38,6 +38,7 @@ static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -140,7 +141,7 @@ __sfvwrite(FILE *fp, struct __suio *uio) fp->_p += w; old_p = fp->_p; if (__fflush(fp) == EOF) { - if (old_p == fp->_p) + if (old_p == fp->_p && errno == EINTR) fp->_p -= w; goto err; } @@ -184,7 +185,7 @@ __sfvwrite(FILE *fp, struct __suio *uio) fp->_p += w; old_p = fp->_p; if (__fflush(fp) == EOF) { - if (old_p == fp->_p) + if (old_p == fp->_p && errno == EINTR) fp->_p -= w; goto err; } diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c index d389cdab0353..666bbf87aadd 100644 --- a/lib/libc/stdio/wbuf.c +++ b/lib/libc/stdio/wbuf.c @@ -91,7 +91,7 @@ __swbuf(int c, FILE *fp) old_p = fp->_p; if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n')) { if (__fflush(fp) != 0) { - if (fp->_p == old_p) { + if (fp->_p == old_p && errno == EINTR) { fp->_p--; fp->_w++; }