/** Get the last library error * * Will only return the last library error once, after which it will return a zero length string. * * @return library error or zero length string */ char const *fr_strerror(void) { char *buffer; buffer = fr_thread_local_get(fr_strerror_buffer); if (buffer && (buffer[FR_STRERROR_BUFSIZE] != '\0')) { buffer[FR_STRERROR_BUFSIZE] = '\0'; /* Flip the 'new' byte to false */ return buffer; } return ""; }
/** Get the last library error * * Will only return the last library error once, after which it will return a zero length string. * * @return library error or zero length string */ char const *fr_strerror(void) { char *buffer; buffer = fr_thread_local_get(fr_strerror_buffer); if (!buffer) return ""; switch (buffer[FR_STRERROR_BUFSIZE * 2]) { default: return ""; case 0x03: buffer[FR_STRERROR_BUFSIZE * 2] &= 0x06; /* Flip the 'new' bit to false */ return buffer; case 0x05: buffer[FR_STRERROR_BUFSIZE * 2] &= 0x06; /* Flip the 'new' bit to false */ return buffer + FR_STRERROR_BUFSIZE; } }