So in the BitKeeper source, perror is redifined to my_perror which is
this:
void
my_perror(char *file, int line, char *msg)
{
char *p = 0;
int save = errno;
if (p = getenv("_BK_VERSION")) {
if (strneq(p, "bk-", 3)) p += 3;
fprintf(stderr, "%s:%d (%s): ", file, line, p);
} else {
fprintf(stderr, "%s:%d: ", file, line);
}
if (p = strerror(errno)) {
fprintf(stderr, "%s: %s\n", msg, p);
} else {
fprintf(stderr, "%s: errno=%d\n", msg, errno);
}
errno = save;
}
libc should do that.