Changeset 5834:22e75d31bfd8 in roaraudio for libroar/roardl.c


Ignore:
Timestamp:
01/06/13 19:56:21 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Fix #296 by using a workaround (disabling RTLD_DEEPBIND). Needs to be fully fixed next release. (See #296)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/roardl.c

    r5823 r5834  
    5959  void *  global_data_state; 
    6060  struct roar_notify_core * notifycore; 
     61  struct roar_vio_calls * stdvios[3]; 
    6162 } context; 
    6263 unsigned int runtime_flags; 
     
    357358 struct roar_dl_lhandle * ret = NULL; 
    358359#if defined(ROAR_HAVE_H_DLFCN) 
    359 #ifdef RTLD_DEEPBIND 
     360#if defined(RTLD_DEEPBIND) && 0 
     361 // FIXME: this is current disabled. See #296. 
    360362 int libdl_flags = RTLD_DEEPBIND; 
    361363#else 
     
    421423 
    422424 ret->para = para; 
     425 
     426 if ( roar_vio_ref(roar_stdin) == 0 ) 
     427  ret->context.stdvios[0] = roar_stdin; 
     428 if ( roar_vio_ref(roar_stdout) == 0 ) 
     429  ret->context.stdvios[1] = roar_stdout; 
     430 if ( roar_vio_ref(roar_stderr) == 0 ) 
     431  ret->context.stdvios[2] = roar_stderr;  
    423432 
    424433 if ( ra_init ) { 
     
    433442    FreeLibrary(ret->handle); 
    434443#endif 
     444   roar_vio_unref(ret->context.stdvios[0]); 
     445   roar_vio_unref(ret->context.stdvios[1]); 
     446   roar_vio_unref(ret->context.stdvios[2]); 
    435447   roar_mm_free(ret); 
    436448   roar_error = err; 
     
    501513 ret = -1; 
    502514#endif 
     515 
     516 roar_vio_unref(lhandle->context.stdvios[0]); 
     517 roar_vio_unref(lhandle->context.stdvios[1]); 
     518 roar_vio_unref(lhandle->context.stdvios[2]); 
    503519 
    504520 if ( lhandle->context.global_data != NULL ) 
     
    726742} 
    727743 
     744static inline void __swap_stdvios(struct roar_dl_lhandle * lhandle) { 
     745 struct roar_vio_calls * vio; 
     746 
     747 vio = roar_stdin; 
     748 roar_stdin = lhandle->context.stdvios[0]; 
     749 lhandle->context.stdvios[0] = vio; 
     750 vio = roar_stdout; 
     751 roar_stdout = lhandle->context.stdvios[1]; 
     752 lhandle->context.stdvios[1] = vio; 
     753 vio = roar_stderr; 
     754 roar_stderr = lhandle->context.stdvios[2]; 
     755 lhandle->context.stdvios[2] = vio; 
     756} 
     757 
    728758int                      roar_dl_context_restore(struct roar_dl_lhandle * lhandle) { 
    729759 struct roar_error_state error_state; 
     
    740770 roar_err_restore(&(lhandle->context.error_state)); 
    741771 lhandle->context.error_state = error_state; 
     772 
     773 __swap_stdvios(lhandle); 
    742774 
    743775 if ( lhandle->lib->global_data_pointer != NULL ) { 
     
    777809  *(lhandle->lib->global_data_pointer) = lhandle->context.global_data_state; 
    778810 } 
     811 
     812 __swap_stdvios(lhandle); 
    779813 
    780814 roar_err_store(&error_state); 
Note: See TracChangeset for help on using the changeset viewer.