From: Richard D. <ric...@us...> - 2007-04-27 06:45:22
|
Update of /cvsroot/file-extattr/File-ExtAttr In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv11532 Modified Files: Changes helpers.c Log Message: Build fix for NetBSD, OpenBSD: Use strerror() if strerror_r() is not available Index: Changes =================================================================== RCS file: /cvsroot/file-extattr/File-ExtAttr/Changes,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Changes 27 Apr 2007 06:14:11 -0000 1.25 --- Changes 27 Apr 2007 06:45:21 -0000 1.26 *************** *** 6,9 **** --- 6,12 ---- and ATTR_TEST_DIR set"; also document ATTR_TEST_DIR. + - (richdawe) Build fix for NetBSD, OpenBSD: Use strerror() + if strerror_r() is not available. + 1.02 2007-04-06 Index: helpers.c =================================================================== RCS file: /cvsroot/file-extattr/File-ExtAttr/helpers.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** helpers.c 28 Aug 2006 11:45:40 -0000 1.3 --- helpers.c 27 Apr 2007 06:45:21 -0000 1.4 *************** *** 9,12 **** --- 9,14 ---- #include "helpers.h" + #ifdef HAS_STRERROR_R + #ifdef __GLIBC__ *************** *** 32,35 **** --- 34,56 ---- #endif + #else /* __GLIBC__ */ + + /* + * No strerror_r(), so impersonate it using strerror(). This may not be + * thread-safe. + */ + static inline char * + my_strerror_r (const int the_errno, char *buf, const size_t buflen) + { + const char *errstr = strerror(the_errno); + + strncpy(buf, errstr, buflen); + buf[buflen - 1] = '\0'; + + return buf; + } + + #endif /* HAS_STRERROR_R */ + void setattr_warn (const char *funcname, const char *attrname, const int the_errno) |