From nobody Sat Apr 20 08:32:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1520556475851345.95454352054196; Thu, 8 Mar 2018 16:47:55 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4477F81DED; Fri, 9 Mar 2018 00:47:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD42D60F90; Fri, 9 Mar 2018 00:47:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 568034CA99; Fri, 9 Mar 2018 00:47:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w290jidm001726 for ; Thu, 8 Mar 2018 19:45:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id B589B53B1A; Fri, 9 Mar 2018 00:45:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64BB4BA8A; Fri, 9 Mar 2018 00:45:42 +0000 (UTC) Received: from zimbra.cs.ucla.edu (zimbra.cs.ucla.edu [131.179.128.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABE1C87622; Fri, 9 Mar 2018 00:45:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 227D7161711; Thu, 8 Mar 2018 16:45:40 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id MIywKypOXOsO; Thu, 8 Mar 2018 16:45:38 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6694B16170F; Thu, 8 Mar 2018 16:45:38 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ozKkQ4pBsZfH; Thu, 8 Mar 2018 16:45:38 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3DCED161701; Thu, 8 Mar 2018 16:45:38 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu From: Paul Eggert To: bug-gnulib@gnu.org, berrange@redhat.com, libvir-list@redhat.com, Eric Blake Date: Thu, 8 Mar 2018 16:45:26 -0800 Message-Id: <20180309004526.25442-1-eggert@cs.ucla.edu> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 09 Mar 2018 00:45:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 09 Mar 2018 00:45:41 +0000 (UTC) for IP:'131.179.128.68' DOMAIN:'zimbra.cs.ucla.edu' HELO:'zimbra.cs.ucla.edu' FROM:'eggert@cs.ucla.edu' RCPT:'' X-RedHat-Spam-Score: -2.311 (RCVD_IN_DNSWL_MED, SPF_PASS, T_RP_MATCHES_RCVD) 131.179.128.68 zimbra.cs.ucla.edu 131.179.128.68 zimbra.cs.ucla.edu X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Paul Eggert Subject: [libvirt] [PATCH] fflush: be more paranoid about libio.h change X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 09 Mar 2018 00:47:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Suggested by Eli Zaretskii in: https://lists.gnu.org/r/emacs-devel/2018-03/msg00270.html * lib/fbufmode.c (fbufmode): * lib/fflush.c (clear_ungetc_buffer_preserving_position) (disable_seek_optimization, rpl_fflush): * lib/fpending.c (__fpending): * lib/fpurge.c (fpurge): * lib/freadable.c (freadable): * lib/freadahead.c (freadahead): * lib/freading.c (freading): * lib/freadptr.c (freadptr): * lib/freadseek.c (freadptrinc): * lib/fseeko.c (fseeko): * lib/fseterr.c (fseterr): * lib/fwritable.c (fwritable): * lib/fwriting.c (fwriting): Look at _IO_ftrylockfile as well as at _IO_EOF_SEEN. --- ChangeLog | 21 +++++++++++++++++++++ lib/fbufmode.c | 3 ++- lib/fflush.c | 9 ++++++--- lib/fpending.c | 3 ++- lib/fpurge.c | 3 ++- lib/freadable.c | 3 ++- lib/freadahead.c | 3 ++- lib/freading.c | 3 ++- lib/freadptr.c | 3 ++- lib/freadseek.c | 3 ++- lib/fseeko.c | 6 ++++-- lib/fseterr.c | 3 ++- lib/fwritable.c | 3 ++- lib/fwriting.c | 3 ++- 14 files changed, 53 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index e858e18fb..a9cd4aed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2018-03-08 Paul Eggert + + fflush: be more paranoid about libio.h change + Suggested by Eli Zaretskii in: + https://lists.gnu.org/r/emacs-devel/2018-03/msg00270.html + * lib/fbufmode.c (fbufmode): + * lib/fflush.c (clear_ungetc_buffer_preserving_position) + (disable_seek_optimization, rpl_fflush): + * lib/fpending.c (__fpending): + * lib/fpurge.c (fpurge): + * lib/freadable.c (freadable): + * lib/freadahead.c (freadahead): + * lib/freading.c (freading): + * lib/freadptr.c (freadptr): + * lib/freadseek.c (freadptrinc): + * lib/fseeko.c (fseeko): + * lib/fseterr.c (fseterr): + * lib/fwritable.c (fwritable): + * lib/fwriting.c (fwriting): + Look at _IO_ftrylockfile as well as at _IO_EOF_SEEN. + 2018-03-07 Paul Eggert =20 maint: write-file-hooks -> before-save-hook diff --git a/lib/fbufmode.c b/lib/fbufmode.c index f711fdfb7..73c64f348 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -31,7 +31,8 @@ fbufmode (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ # if HAVE___FLBF /* glibc >=3D 2.2 */ if (__flbf (fp)) return _IOLBF; diff --git a/lib/fflush.c b/lib/fflush.c index a6edfa105..a140b7ad9 100644 --- a/lib/fflush.c +++ b/lib/fflush.c @@ -33,7 +33,8 @@ #undef fflush =20 =20 -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 +/* GNU libc, BeOS, Haiku, Linux libc5 */ =20 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). = */ static void @@ -72,7 +73,8 @@ clear_ungetc_buffer (FILE *fp) =20 #endif =20 -#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS,= Haiku, Linux libc5 */) +#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__= =3D=3D 1) +/* GNU libc, BeOS, Haiku, Linux libc5 */ =20 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) &= & defined __SNPT /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android= */ @@ -148,7 +150,8 @@ rpl_fflush (FILE *stream) if (stream =3D=3D NULL || ! freading (stream)) return fflush (stream); =20 -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ =20 clear_ungetc_buffer_preserving_position (stream); =20 diff --git a/lib/fpending.c b/lib/fpending.c index 789f50e4e..7bc235ded 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -32,7 +32,8 @@ __fpending (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ return fp->_IO_write_ptr - fp->_IO_write_base; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ diff --git a/lib/fpurge.c b/lib/fpurge.c index 3aedcc373..554790b56 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -62,7 +62,8 @@ fpurge (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, H= aiku, Linux libc5 */ +# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_IO_read_end =3D fp->_IO_read_ptr; fp->_IO_write_ptr =3D fp->_IO_write_base; /* Avoid memory leak when there is an active ungetc buffer. */ diff --git a/lib/freadable.c b/lib/freadable.c index c4ca0b86e..53cdbee08 100644 --- a/lib/freadable.c +++ b/lib/freadable.c @@ -31,7 +31,8 @@ freadable (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & _IO_NO_READS) =3D=3D 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ diff --git a/lib/freadahead.c b/lib/freadahead.c index 23ec76ee5..ed3dd0ebd 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -30,7 +30,8 @@ extern size_t __sreadahead (FILE *); size_t freadahead (FILE *fp) { -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return 0; return (fp->_IO_read_end - fp->_IO_read_ptr) diff --git a/lib/freading.c b/lib/freading.c index c24d0c88a..790f92ca3 100644 --- a/lib/freading.c +++ b/lib/freading.c @@ -31,7 +31,8 @@ freading (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, H= aiku, Linux libc5 */ +# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ return ((fp->_flags & _IO_NO_WRITES) !=3D 0 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) =3D=3D= 0 && fp->_IO_read_base !=3D NULL)); diff --git a/lib/freadptr.c b/lib/freadptr.c index ffb801039..3afa62149 100644 --- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -29,7 +29,8 @@ freadptr (FILE *fp, size_t *sizep) size_t size; =20 /* Keep this code in sync with freadahead! */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ if (fp->_IO_write_ptr > fp->_IO_write_base) return NULL; size =3D fp->_IO_read_end - fp->_IO_read_ptr; diff --git a/lib/freadseek.c b/lib/freadseek.c index 5fd2dd7ca..b11845cd5 100644 --- a/lib/freadseek.c +++ b/lib/freadseek.c @@ -36,7 +36,8 @@ freadptrinc (FILE *fp, size_t increment) /* Keep this code in sync with freadptr! */ #if HAVE___FREADPTRINC /* musl libc */ __freadptrinc (fp, increment); -#elif defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, = Haiku, Linux libc5 */ +#elif defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_IO_read_ptr +=3D increment; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ diff --git a/lib/fseeko.c b/lib/fseeko.c index 193f4e8ce..e5c5172e7 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -47,7 +47,8 @@ fseeko (FILE *fp, off_t offset, int whence) #endif =20 /* These tests are based on fpurge.c. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ if (fp->_IO_read_end =3D=3D fp->_IO_read_ptr && fp->_IO_write_ptr =3D=3D fp->_IO_write_base && fp->_IO_save_base =3D=3D NULL) @@ -123,7 +124,8 @@ fseeko (FILE *fp, off_t offset, int whence) return -1; } =20 -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_flags &=3D ~_IO_EOF_SEEN; fp->_offset =3D pos; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ diff --git a/lib/fseterr.c b/lib/fseterr.c index adb637256..fd9da6338 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -29,7 +29,8 @@ fseterr (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ fp->_flags |=3D _IO_ERR_SEEN; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ diff --git a/lib/fwritable.c b/lib/fwritable.c index 3b1a380ec..24a148aee 100644 --- a/lib/fwritable.c +++ b/lib/fwritable.c @@ -31,7 +31,8 @@ fwritable (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & _IO_NO_WRITES) =3D=3D 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ diff --git a/lib/fwriting.c b/lib/fwriting.c index 4a3d9c8d4..9be6fb220 100644 --- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -27,7 +27,8 @@ fwriting (FILE *fp) /* Most systems provide FILE as a struct and the necessary bitmask in , because they need it for implementing getc() and putc() as fast macros. */ -#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ =3D=3D 1 /* GNU libc, BeOS, Ha= iku, Linux libc5 */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ = =3D=3D 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) !=3D 0; #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Andro= id */ --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list