File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/main/ruby/truffleruby/core Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -215,9 +215,10 @@ def self.setproctitle_darwin(title)
215
215
argv0_address = Truffle ::POSIX . _NSGetArgv . read_pointer . read_pointer
216
216
217
217
@_argv0_max_length ||= argv0_address . read_string . bytesize
218
+ argv0_address = argv0_address . slice ( 0 , @_argv0_max_length )
218
219
219
220
new_title = setproctitle_truncate_title ( title , @_argv0_max_length )
220
- argv0_address . write_string new_title
221
+ argv0_address . write_bytes new_title
221
222
end
222
223
private_class_method :setproctitle_darwin
223
224
@@ -259,8 +260,8 @@ def self.setproctitle_linux_from_proc_maps(title)
259
260
260
261
new_title = setproctitle_truncate_title ( title , @_argv0_max_length )
261
262
262
- argv0_ptr = FFI ::Pointer . new ( :char , @_argv0_address )
263
- argv0_ptr . write_string ( new_title )
263
+ argv0_ptr = FFI ::Pointer . new ( :char , @_argv0_address ) . slice ( 0 , @_argv0_max_length )
264
+ argv0_ptr . write_bytes ( new_title )
264
265
265
266
new_command = File . binread ( '/proc/self/cmdline' )
266
267
raise 'failed' unless new_command . start_with? ( new_title )
You can’t perform that action at this time.
0 commit comments