Fixed byte conversion issue during logging under zlinux

This commit is contained in:
Breno Silva
2012-10-31 17:07:42 -04:00
parent f22bca10f8
commit 408f37015e
5 changed files with 27 additions and 1 deletions

View File

@@ -229,7 +229,11 @@ static char *construct_auditlog_filename(apr_pool_t *mp, const char *uniqueid) {
* as an audit log boundary.
*/
static char *create_auditlog_boundary(request_rec *r) {
#ifdef LINUX_S390
int data = swap_int32(rand());
#else
unsigned long data = rand();
#endif
/* Do note that I tried using apr_generate_random_bytes but it turned
* out to be terribly slow for some reason. Needs further investigation.
*/

View File

@@ -74,6 +74,15 @@ static unsigned char *c2x(unsigned what, unsigned char *where);
static unsigned char x2c(unsigned char *what);
static unsigned char xsingle2c(unsigned char *what);
#ifdef LINUX_S390
int swap_int32(int x) {
int swap = ((x>>24)&0xff) | ((x<<8)&0xff0000) |
((x>>8)&0xff00) | ((x<<24)&0xff000000);
return swap;
}
#endif
/** \brief Decode utf-8 to unicode format.
*
* \param mp Pointer to memory pool

View File

@@ -46,6 +46,11 @@ int DSOLOCAL inet_pton(int family, const char *src, void *dst);
#define UNICODE_ERROR_RESTRICTED_CHARACTER -4
#define UNICODE_ERROR_DECODING_ERROR -5
#ifdef LINUX_S390
int DSOLOCAL swap_int32(int x);
#endif
char DSOLOCAL *utf8_unicode_inplace_ex(apr_pool_t *mp, unsigned char *input, long int input_len, int *changed);
char DSOLOCAL *m_strcasestr(const char *haystack, const char *needle);