pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:2222:    if( !CryptGenRandom(crypto_handle, size, (BYTE*)res->str) )    {    do_free_unlinked_pike_string (res);    Pike_error("Failed to create random data.\n");    }       RETURN end_shared_string(res);    }   }   #else - static int random_fd; + static int random_fd = -1;   PIKECLASS RandomSystem   {    INHERIT RandomInterface;       PIKEFUN string(8bit) random_string(int len)    {    if( len<1 )    RETURN empty_pike_string;       if( random_fd==-1 )
pike.git/src/builtin.cmod:6050:    }   }      void init_builtin(void)   {    SET_SVAL(gc_pre_cb, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    SET_SVAL(gc_post_cb, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    SET_SVAL(gc_destruct_cb, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    SET_SVAL(gc_done_cb, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    INIT; -  random_fd = -1; +    }      void exit_builtin(void)   {    struct svalue zero;    if (val_module) free_object (val_module);    EXIT;    SET_SVAL(zero, PIKE_T_INT, NUMBER_NUMBER, integer, 0);    assign_svalue(&gc_pre_cb, &zero);    assign_svalue(&gc_post_cb, &zero);
pike.git/src/builtin.cmod:6073:   #ifndef DO_PIKE_CLEANUP    /* This is performed by exit_builtin_modules() at a later point    * in this case, so that the pike_list_node's are valid at cleanup    * time, thus avoiding "got invalid pointer" fatals at exit.    */    ba_destroy(&pike_list_node_allocator);   #endif   #ifndef USE_SETENV    if (env_allocs) free_mapping (env_allocs);   #endif + #ifdef __NT__ +  if (crypto_handle) CloseHandle(crypto_handle); + #else    if (random_fd!=-1) close(random_fd); -  + #endif   }