Skip to contentSkip to conversation

build error: strerror() ...

DISCUSSION Gerd Hoffmann 3 participants 4 messages Dec 8, 2006 – Dec 9, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

changeset 12809 gives me this:

xc_private.c: In function ‘safe_strerror’:
xc_private.c:500: warning: return makes pointer from integer without a cast make[3]: *** [xc_private.o] Error 1

cheers,
Gerd

Signature · 1 line
Gerd Hoffmann <[email protected]>
#1 lore raw

strerror_r() sucks. I removed it and used a pthread mutex instead.

K.

Quoted 10 lines · Gerd Hoffmann

Hi,

changeset 12809 gives me this:

xc_private.c: In function Œsafe_strerror¹:
xc_private.c:500: warning: return makes pointer from integer without a cast make[3]: *** [xc_private.o] Error 1

cheers,
Gerd

#2 lore raw
Quoted 2 lines · Keir Fraser

strerror_r() sucks. I removed it and used a pthread mutex instead.

If you '#define _XOPEN_SOURCE 600' then glibc will provide the standards compliant version of strerror_r which always uses the user supplied buffer. Seems simpler than rolling our own code using pthreads mutexes.

[quote strerror_r(3)]

       #define _XOPEN_SOURCE 600
       #include <string.h>

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


      .....

       The  XSI-compliant  strerror_r() is preferred for portable applications.  It returns
       the error string in the user-supplied buffer buf of length buflen.

[/quote]

Regards,
Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#3 lore raw
Quoted 5 lines · Daniel P. Berrange
Quoted 1 line

strerror_r() sucks. I removed it and used a pthread mutex instead.

If you '#define _XOPEN_SOURCE 600' then glibc will provide the standards compliant version of strerror_r which always uses the user supplied buffer. Seems simpler than rolling our own code using pthreads mutexes.

My Debian build box defines only the GNU version.

It seems that strerror_r() is basically unusable unless you do a 'configure'-style compile test to set a build flag.

-- Keir