Merge 10.11 into 11.4

This commit is contained in:
Marko Mäkelä
2025-01-09 07:58:08 +02:00
473 changed files with 4731 additions and 3149 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
}
/*