diff --git a/fdostream.cpp b/fdostream.cpp index 3c2ed1b..d087312 100644 --- a/fdostream.cpp +++ b/fdostream.cpp @@ -16,13 +16,22 @@ std::streambuf::int_type sc::io::fdoutbuf::overflow(std::streambuf::int_type c) { if (c != EOF) { - if (::write(_fd, &c, 1) != 1) { + int res; + if ((res = ::write(_fd, &c, 1)) != 1) { return EOF; } + else { + std::cerr << "write result = " << res << ", errno = " << errno << '\n'; + } } return c; } std::streamsize sc::io::fdoutbuf::xsputn(const char* s, std::streamsize num) { - return ::write(_fd, s, num); + int res = ::write(_fd, s, num); + if (res != num) { + std::cerr << "write result = " << res << ", errno = " << errno << '\n'; + return EOF; + } + return res; }