Merge remote branch 'h-github/master' into win32-port2
* h-github/master: (64 commits)
refix socket wrappers with rk_
Patch from Secure Endpoints/Asanka Herath for windows support
unset KRB5CCNAME
its really just LIBADD more most of them
correct quoting
Use -lpthread for modern freebsd instead
clean KRB5CCNAME and KRB5_CONFIG, require test to reset them
more up ${env_setup}
use PTHREADS_LIBADD for freebsd6 and newer
add PTHREAD_LIBADD
add PTHREAD_LIBADD
add PTHREAD_LIBADD
switch to PTHREADS_LIBADD
log what the error string say too
More debug logging
sprinkle more 'echo "test failed"'
sprinkle 'echo "test failed"'
use calloc(), indent more prettier
in sh, equal compare is really = for strings, not ==
Check for duplicates, already loaded mechs
...
Conflicts (resolved):
lib/krb5/auth_context.c
lib/krb5/changepw.c
lib/krb5/context.c
lib/krb5/error_string.c
lib/krb5/kuserok.c
lib/krb5/libkrb5-exports.def.in
lib/krb5/net_write.c
lib/krb5/store_fd.c
lib/krb5/test_cc.c
lib/roken/strerror_r.c
This commit is contained in:
@@ -33,32 +33,48 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(HAVE_STRERROR_R) && !defined(STRERROR_R_PROTO_COMPATIBLE)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
char * ROKEN_LIB_FUNCTION
|
||||
strerror_r(int eno, char * strerrbuf, size_t buflen)
|
||||
int ROKEN_LIB_FUNCTION
|
||||
rk_strerror_r(int eno, char * strerrbuf, size_t buflen)
|
||||
{
|
||||
errno_t err;
|
||||
|
||||
err = strerror_s(strerrbuf, buflen, eno);
|
||||
if (err != 0)
|
||||
sprintf_s(strerrbuf, buflen, "Error % occurred.", eno);
|
||||
if (err != 0) {
|
||||
int code;
|
||||
code = sprintf_s(strerrbuf, buflen, "Error % occurred.", eno);
|
||||
err = ((code != 0)? errno : 0);
|
||||
}
|
||||
|
||||
return strerrbuf;
|
||||
return err;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* _MSC_VER */
|
||||
|
||||
#ifndef HAVE_STRERROR_R
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
char* ROKEN_LIB_FUNCTION
|
||||
strerror_r(int eno, char *strerrbuf, size_t buflen)
|
||||
int ROKEN_LIB_FUNCTION
|
||||
rk_strerror_r(int eno, char *strerrbuf, size_t buflen)
|
||||
{
|
||||
/* Assume is the linux broken strerror_r (returns the a buffer (char *) if the input buffer wasn't use */
|
||||
#ifdef HAVE_STRERROR_R
|
||||
const char *str;
|
||||
str = strerror_r(eno, strerrbuf, buflen);
|
||||
if (str != strerrbuf)
|
||||
if (strlcpy(strerrbuf, str, buflen) >= buflen)
|
||||
return ERANGE;
|
||||
return 0;
|
||||
#else
|
||||
int ret;
|
||||
if(eno < 0 || eno >= sys_nerr) {
|
||||
snprintf(strerrbuf, buflen, "Error %d occurred.", eno);
|
||||
@@ -68,6 +84,9 @@ strerror_r(int eno, char *strerrbuf, size_t buflen)
|
||||
if (ret > buflen)
|
||||
return ERANGE;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !_MSC_VER */
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user