Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-10-25 17:15:28


Oliver.Kowalke_at_[hidden] wrote:
> Hi,
> LINUX and HP/UX have different strerror_r functions. At least for me the
> moduification works.

OK, I'm just now starting to apply backed up patches and fixes. It will
take several days to get them integrated and tested.

Thanks,

--Beman

>
> regards,
> Oliver
>
> std::string errno_md( const error_code & ec )
> {
> # if !defined(BOOST_WINDOWS_API) // does not have strerror_t
> #if defined(__linux)
> char buf[64];
> char * bp = buf;
> std::size_t sz = sizeof(buf);
> return strerror_r( ec.value(), bp, sz);
> #elif defined(__hpux)
> return strerror( ec.value() );
> #else
> char buf[64];
> char * bp = buf;
> std::size_t sz = sizeof(buf);
> int result;
> while ( (result = strerror_r( ec.value(), bp, sz )) == ERANGE )
> {
> if ( sz > sizeof(buf) ) std::free( bp );
> sz *= 2;
> if ( (bp = static_cast<char*>(std::malloc( sz ))) == 0 )
> return std::string( "ENOMEM" );
> }
> std::string msg( ( result == EINVAL ) ? "EINVAL" : bp );
> if ( sz > sizeof(buf) ) std::free( bp );
> return msg;
> # endif
> # else
> const char * c_str = std::strerror( ec.value() );
> return std::string( c_str ? c_str : "EINVAL" );
> # endif
> }
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk