| 802 | return g_sys_setenv_func( n,value,overwrite ); |
| 803 | } |
| 804 | int unsetenv(const char *n) |
| 805 | { |
| 806 | HOOK_SYS_FUNC( unsetenv ) |
| 807 | if( co_is_enable_sys_hook() && g_co_sysenv.data ) |
| 808 | { |
| 809 | stCoRoutine_t *self = co_self(); |
| 810 | if( self ) |
| 811 | { |
| 812 | if( !self->pvEnv ) |
| 813 | { |
| 814 | self->pvEnv = dup_co_sysenv_arr( &g_co_sysenv ); |
| 815 | } |
| 816 | stCoSysEnvArr_t *arr = (stCoSysEnvArr_t*)(self->pvEnv); |
| 817 | |
| 818 | stCoSysEnv_t name = { (char*)n,0 }; |
| 819 | |
| 820 | stCoSysEnv_t *e = (stCoSysEnv_t*)bsearch( &name,arr->data,arr->cnt,sizeof(name),co_sysenv_comp ); |
| 821 | |
| 822 | if( e ) |
| 823 | { |
| 824 | if( e->value ) |
| 825 | { |
| 826 | free( e->value ); |
| 827 | e->value = 0; |
| 828 | } |
| 829 | return 0; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | } |
| 834 | return g_sys_unsetenv_func( n ); |
| 835 | } |
| 836 | char *getenv( const char *n ) |
| 837 | { |
| 838 | HOOK_SYS_FUNC( getenv ) |
nothing calls this directly
no test coverage detected