libc: Restore fp state upon flush error in fputc
This is akin to commit bafaa70b6f9098d83d074968c8e6747ecec1e118.
Approved by: re (gjb)
Reported by: Guy Yur <guyyur@gmail.com>
Fixes: 86a16ada1ea6
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 6e13794fbe6e82c21365d0fd66769bf8b19c0197)
(cherry picked from commit 7be0c792c46c5a1faf46b611058953aa85b192d6)