Sha256: 0c6f0e568fb8111118dea233fa0f78b80a1249042e80af284566b5910b65bbb0
Contents?: true
Size: 1.5 KB
Versions: 7
Compression:
Stored size: 1.5 KB
Contents
/* Copyright (c) 2020 Contrast Security, Inc. See * https://www.contrastsecurity.com/enduser-terms-0317a for more details. */ #include "cs__protect_kernel.h" #include "../cs__common/cs__common.h" #include <ruby.h> static VALUE contrast_protect_fork(const int argc, const VALUE *argv, const VALUE self) { VALUE ret; if (rb_block_given_p()) { VALUE wrapper; wrapper = rb_funcall_with_block(rb_mKernel, rb_sym_protect_kernel_wrapper, 0, NULL, rb_block_proc()); ret = rb_funcall_with_block(self, rb_sym_protect_kernel_fork, argc, argv, wrapper); } else { ret = rb_funcall2(self, rb_sym_protect_kernel_fork, argc, argv); } return ret; } void Init_cs__protect_kernel(void) { rb_sym_protect_kernel_fork = rb_intern("cs__protect_kernel_fork"); rb_sym_protect_kernel_wrapper = rb_intern("cs__protect_build_wrapper"); VALUE singleton = rb_singleton_class(rb_mKernel); contrast_alias_method(rb_mKernel, "cs__protect_kernel_fork", "fork"); contrast_alias_method(singleton, "cs__protect_kernel_fork", "fork"); rb_define_module_function(rb_mKernel, "fork", contrast_protect_fork, -1); // Kernel#fork, as opposed to Kernel.fork, is private. Restore that. rb_funcall(rb_mKernel, rb_intern("public"), 1, ID2SYM(rb_intern("cs__protect_kernel_fork"))); rb_funcall(rb_mKernel, rb_intern("private"), 1, ID2SYM(rb_intern("fork"))); }
Version data entries
7 entries across 7 versions & 1 rubygems