From nobody Sat Sep 03 01:16:26 2022 X-Original-To: dev-commits-src-main@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 4MKH163wKQz4btfg; Sat, 3 Sep 2022 01:16: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 4MKH163HSxz3LXn; Sat, 3 Sep 2022 01:16:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662167786; 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=Rif+94i/rT0OyDxs6sHTYvLa55ZQsfAvucihh1tFsWQ=; b=odQbpsAW5Te2fVbpVEyJqoGOqyEFCz7PV79RpcgzNklhoFIFu4sMJffcSdlAKVpqk88AHm 88tQv23+f2rViusZcqHZ4BN9mlpC+9P5wrGCNw9tnOpO1NVcecf2g2VM1eOTWen5pIb84j wo9so8y8MdhR31EL9for4hj60j7tV7YlkpReEANMd6vpSUfGRb8RiAHSDOpFGTFimp2KBe 3ggeYDRUiSnntrCPo7F+GTUQsyaW2KQAeIl4BhdnRdXrldogVKAiG3qy2Qu/xCVxJ5SfgO sJxaej7Jrsdsi7+kwgu/ClYunTybLrDoPunHqYZXBPtu1afCw98hgrTVvutCkA== 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 4MKH162Krcz108r; Sat, 3 Sep 2022 01:16:26 +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 2831GQMn090104; Sat, 3 Sep 2022 01:16:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2831GQOZ090103; Sat, 3 Sep 2022 01:16:26 GMT (envelope-from git) Date: Sat, 3 Sep 2022 01:16:26 GMT Message-Id: <202209030116.2831GQOZ090103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 44cf1e5eb470 - main - libc/stdio: only roll FILE state back on EINTR List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 44cf1e5eb470380442fa8e240e213a71b8fe81d4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662167786; 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=Rif+94i/rT0OyDxs6sHTYvLa55ZQsfAvucihh1tFsWQ=; b=Syw2vZv4hUTOqx61DUvcoUM0UVkSWBK+vEuMnsfEuNQ7qi7qvwL0/7v/V/HSlLN1I9uU7t uBIm1qY6hl/rQH8lVBB7ZDM0g4jHmBkSeLI9RUdWIsMszPtnEc/JHwZGP6GocxPmTzsYle Vy4/1A8uIrZk1uzyoffeYv/zw27QVTxkK5mc6fAEs/F6924GWhck1lE5KSr64hQ7bUrSXf SIN7qTf78oc+mU15ZCX9F6EvHZw4xxDCAK5+M73a9zwh5/mkJJALJ+bTPRSs8tOi1kQy4s dJtbGa/IPU15jg4Ai5OjmKUaI8pZFvBTyqrlqUUvCOSpCoRd8pYs/DMdidCILQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662167786; a=rsa-sha256; cv=none; b=kne4drofJR1rSu0CNkeOCTfCahp1GgfnZyQNYlfERcbjNYMtfqpcgczHBbrboYY2E0n7vM 1tJWeabOSIuM+sxaE48CUFFmT/8HQIuzZx+m671gEPM1+u//jwdNP4IC00gJp3vUOa8A0U RJ7KGP/wKmJHEWK1TNumXOM+EmQB3NMQBjhLkiqrrYeXn5JP6IjhjwK6iLwmopLlOsCu0A ONrXT3LH1hY6dofxdWAV2ekBfglfZh9LY2FHh8oQIVhkeREynQfQnTm5Ouag8OgglkTE2E QJsumEq4SmwWoPqmkSITMNiYt61eamML9Im8ZpXN2WuDtHgnH1+DXf8VVwR18w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=44cf1e5eb470380442fa8e240e213a71b8fe81d4 commit 44cf1e5eb470380442fa8e240e213a71b8fe81d4 Author: Konstantin Belousov AuthorDate: 2022-09-02 13:39:38 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-03 01:06:41 +0000 libc/stdio: only roll FILE state back on EINTR Reported by: JunT PR: 266171 Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36427 --- 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++; }