Ticket #11929: 560-res_init_asterisk.patch

File 560-res_init_asterisk.patch, 2.4 KB (added by marko, 5 years ago)

patch reordering res_init to fix asterisk dns hangup

  • libc/inet/resolv.c

    a b  
    35803580} 
    35813581#endif 
    35823582 
    3583 /* This needs to be after the use of _res in res_init, above.  */ 
    3584 #undef _res 
    3585  
    3586 #ifndef __UCLIBC_HAS_THREADS__ 
    3587 /* The resolver state for use by single-threaded programs. 
    3588    This differs from plain `struct __res_state _res;' in that it doesn't 
    3589    create a common definition, but a plain symbol that resides in .bss, 
    3590    which can have an alias.  */ 
    3591 struct __res_state _res __attribute__((section (".bss"))); 
    3592 struct __res_state *__resp = &_res; 
    3593 #else /* __UCLIBC_HAS_THREADS__ */ 
    3594 struct __res_state _res __attribute__((section (".bss"))) attribute_hidden; 
    3595  
    3596 # if defined __UCLIBC_HAS_TLS__ 
    3597 #  undef __resp 
    3598 __thread struct __res_state *__resp = &_res; 
    3599 /* 
    3600  * FIXME: Add usage of hidden attribute for this when used in the shared 
    3601  *        library. It currently crashes the linker when doing section 
    3602  *        relocations. 
    3603  */ 
    3604 extern __thread struct __res_state *__libc_resp 
    3605        __attribute__ ((alias ("__resp"))) attribute_hidden; 
    3606 # else 
    3607 #  undef __resp 
    3608 struct __res_state *__resp = &_res; 
    3609 # endif 
    3610 #endif /* !__UCLIBC_HAS_THREADS__ */ 
    3611  
    36123583static unsigned int 
    36133584res_randomid(void) 
    36143585{ 
     
    36643635} 
    36653636libc_hidden_def(res_init) 
    36663637 
     3638/* This needs to be after the use of _res in res_init, above.  */ 
     3639#undef _res 
     3640 
     3641#ifndef __UCLIBC_HAS_THREADS__ 
     3642/* The resolver state for use by single-threaded programs. 
     3643   This differs from plain `struct __res_state _res;' in that it doesn't 
     3644   create a common definition, but a plain symbol that resides in .bss, 
     3645   which can have an alias.  */ 
     3646struct __res_state _res __attribute__((section (".bss"))); 
     3647struct __res_state *__resp = &_res; 
     3648#else /* __UCLIBC_HAS_THREADS__ */ 
     3649struct __res_state _res __attribute__((section (".bss"))) attribute_hidden; 
     3650 
     3651# if defined __UCLIBC_HAS_TLS__ 
     3652#  undef __resp 
     3653__thread struct __res_state *__resp = &_res; 
     3654/* 
     3655 * FIXME: Add usage of hidden attribute for this when used in the shared 
     3656 *        library. It currently crashes the linker when doing section 
     3657 *        relocations. 
     3658 */ 
     3659extern __thread struct __res_state *__libc_resp 
     3660       __attribute__ ((alias ("__resp"))) attribute_hidden; 
     3661# else 
     3662#  undef __resp 
     3663struct __res_state *__resp = &_res; 
     3664# endif 
     3665#endif /* !__UCLIBC_HAS_THREADS__ */ 
     3666 
     3667 
    36673668/* 
    36683669 * Set up default settings.  If the configuration file exist, the values 
    36693670 * there will have precedence.  Otherwise, the server address is set to