bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SockExcpetion getSystemErrorString() method gives unexpected result


From: Gunnar Harms
Subject: Re: SockExcpetion getSystemErrorString() method gives unexpected result
Date: Tue, 4 Oct 2011 13:41:35 +0200

Hello list,

I found the cause of my issue. It's about which variant of strerror_r is used.

From strerror_r man pages:

char *strerror_r(int errnum, char *buf, size_t buflen);
                               /* GNU-specific strerror_r() */

#define _XOPEN_SOURCE 600
 #include <string.h>

int strerror_r(int errnum, char *buf, size_t buflen);
                          /* XSI-compliant strerror_r() */



commoncpp library assumes the XSI compliant variant. But during build the GNU 
variant is chosen. The GNU variant takes the first parameter but doesn't put 
text in it.


My question now is, why does configure not sort this out for us? Can I build a 
correct working commoncpp library without changing source code (exception.cpp) 
or build configuration files myself?

Is this mailing list still alive btw?

All the best from Holland,
Gunnar









On Oct 3, 2011, at 11:50 AM, Gunnar Harms wrote:

> Hello list,
> 
> I am migrating a program from Mac OS-X to Linux and have some issues with 
> Socket/SockException classes. On both Mac OS-X as well as Linux the commoncpp 
> libs were built with configure script. Before posting the actual build 
> configurations I'll just show you the issue, and perhaps someone immediately 
> recognizes the cause of my issue.
> 
> 
> When the application catches a SockException it logs for example:
> 
>       catch (SockException& e) {
>               log(string("processNextMessage() : caught a SockException: ") + 
> e.getString() + ": " + e.getSystemErrorString());
>       }
> 
> 
> 
> On Mac OS-X this give log lines like:
> 
> processNextMessage() : caught a SockException during connect(): Could not 
> connect to remote host: Connection refused
> 
> 
> 
> 
> But on Linux I see in log file like:
> 
> processNextMessage() : caught a SockException: Could not connect to remote 
> host: ?u?0
> 
> 
> 
> So, the getSystemErrorString() returned "?u?0" in this case, but this varies 
> but is always garbage (eg. "P??0", "?" etc.)
> 
> 
> 
> Version of commoncpp is 2-1.8.0 and uname -msr tells me that the Linux 
> version is Linux 2.6.18-128.el5 x86_64.
> 
> Thank you for your time.
> 
> Gunnar
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]