]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libc __sfvwrite(): roll back FILE buffer pointer on fflush error
authorKonstantin Belousov <kib@FreeBSD.org>
Sun, 6 Mar 2022 08:59:39 +0000 (10:59 +0200)
committerMark Johnston <markj@FreeBSD.org>
Sun, 6 Mar 2022 15:29:51 +0000 (10:29 -0500)
commitbafaa70b6f9098d83d074968c8e6747ecec1e118
treedccf723ecd2bdf842862c7d14e73852d9e2e0806
parent1fb00c8f1060e18fed621f13d31db7b336d2267e
libc  __sfvwrite(): roll back FILE buffer pointer on fflush error

__sfvwrite() advances the pointer before calling fflush.  If fflush()
fails, it is not enough to roll back inside it, because we cannot know
how much was advanced by the caller.

Reported by: Peter <pmc@citylink.dinoex.sub.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Fixes: 86a16ada1ea608408cec370171d9f59353e97c77
lib/libc/stdio/fvwrite.c