Merge branch '10.5' into '10.6'

This commit is contained in:
Julius Goryavsky 2024-12-18 05:09:23 +01:00
commit 3cd9f9d1b3
17 changed files with 221 additions and 115 deletions

View file

@ -894,6 +894,27 @@ int my_fprintf(FILE *stream, const char* format, ...)
}
#ifdef __APPLE__
/* Delete the ':' character added by Apple's implementation of strerror_r */
static void delete_colon_char(char *buf)
{
static const char *unknown_err= "Unknown error";
static const size_t unknown_err_len= 13;
char *ptr= strstr(buf, unknown_err);
char *src= NULL;
if (ptr) {
ptr+= unknown_err_len;
if (*ptr == ':') {
// just overwrite the colon by shifting everything down by one,
// e.g. "Unknown error: 1000" becomes "Unknown error 1000"
src= ptr + 1;
memmove(ptr, src, strlen(src) + 1); // include null
}
}
}
#endif
/*
Return system error text for given error number
@ -947,6 +968,10 @@ const char* my_strerror(char *buf, size_t len, int nr)
#else
strerror_r(nr, buf, len);
#endif
#ifdef __APPLE__
delete_colon_char(buf);
#endif
}
/*