Comment 2 for bug 217878

Revision history for this message
Steven Sheehy (steven-sheehy) wrote :

On POSIX strerror_r returns an int, and on GNU it returns a char*. This will cause trouble on different systems. I understand the need for a thread safe version of strerror, but it may not be worth it if causes compilation issues. It is doubtful different threads call strerror at the exact same time and even if they did it will only affect the error's output, not some core functionality of the program.

Also, allocating so much memory on the stack will cause some flavors of *nix to fail (particularly the BSD family). If we're going to keep strerror_r, char[] needs to be changed to a boost::scoped_array (AutoArray in old dcpp cores) so that it allocates on the heap and automatically deletes itself when it goes out of scope. Because of these two issues, I recommend we keep strerror.

In the write function, "int left" needs to be of type size_t and pointer should probably be void*. They will work as is, but we should probably use the types the system call requires.