Make seeking on an ostream that has eofbit set work correctly. Fixes PR#21361

llvm-svn: 240286
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 99f5fc937f1042b24188a92bf2fe40f151d023bb
diff --git a/include/ostream b/include/ostream
index a7af299..f55fd40 100644
--- a/include/ostream
+++ b/include/ostream
@@ -1004,7 +1004,7 @@
 basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
 {
     sentry __s(*this);
-    if (__s)
+    if (!this->fail())
     {
         if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
             this->setstate(ios_base::failbit);
@@ -1018,7 +1018,7 @@
 basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
 {
     sentry __s(*this);
-    if (__s)
+    if (!this->fail())
     {
         if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
             this->setstate(ios_base::failbit);