| 678 | static acl_pthread_once_t once_control = ACL_PTHREAD_ONCE_INIT; |
| 679 | |
| 680 | const char *acl_strerror1(unsigned int errnum) |
| 681 | { |
| 682 | char *buf; |
| 683 | static int __buf_size = 4096; |
| 684 | |
| 685 | if (acl_pthread_once(&once_control, thread_buf_init) != 0) { |
| 686 | abort(); |
| 687 | } |
| 688 | |
| 689 | buf = acl_pthread_getspecific(__errbuf_key); |
| 690 | if (buf == NULL) { |
| 691 | buf = acl_mymalloc(__buf_size); |
| 692 | if (acl_pthread_setspecific(__errbuf_key, buf) != 0) { |
| 693 | abort(); |
| 694 | } |
| 695 | #if !defined(HAVE_NO_ATEXIT) |
| 696 | if ((unsigned long) acl_pthread_self() |
| 697 | == acl_main_thread_self()) { |
| 698 | __main_buf = buf; |
| 699 | atexit(main_free_buf); |
| 700 | } |
| 701 | #endif |
| 702 | } |
| 703 | return acl_strerror(errnum, buf, __buf_size); |
| 704 | } |
| 705 | |
| 706 | const char *acl_last_serror(void) |
| 707 | { |
no test coverage detected
searching dependent graphs…