[llvm-commits] [llvm] r75758 - /llvm/trunk/lib/Support/raw_ostream.cpp

Daniel Dunbar daniel at zuster.org
Thu Jul 16 20:15:55 PDT 2009


On Thu, Jul 16, 2009 at 3:19 AM, Eli Friedman<eli.friedman at gmail.com> wrote:
> On Wed, Jul 15, 2009 at 1:12 AM, Daniel Dunbar<daniel at zuster.org> wrote:
>> @@ -285,7 +286,8 @@
>>  void raw_fd_ostream::write_impl(const char *Ptr, unsigned Size) {
>>   assert (FD >= 0 && "File already closed.");
>>   pos += Size;
>> -  ::write(FD, Ptr, Size);
>> +  if (::write(FD, Ptr, Size) != (ssize_t) Size)
>> +    llvm_report_error("IO failure writing to output stream.");
>>  }
>
> This isn't really right... unlike fwrite(), the fact that the returned
> value from write() isn't the same as the input parameter doesn't
> necessarily indicate an error.

True, but it does indicate that the current code failed to implement
the write correctly.

 - Daniel




More information about the llvm-commits mailing list