ragweed 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.2.8
@@ -348,13 +348,14 @@ module Ragweed::Wraposx
348
348
  def execv(path, *args)
349
349
  FFI.errno = 0
350
350
  args.flatten!
351
- argv = FFI::MemoryPointer.new(:pointer, args.size + 1)
351
+ argv = FFI::MemoryPointer.new(:pointer, args.size + 2)
352
+ argv[0].put_pointer(0, FFI::MemoryPointer.from_string(path.to_s))
352
353
  args.each_with_index do |arg, i|
353
- argv[i].put_pointer(0, FFI::MemoryPointer.from_string(arg.to_s))
354
+ argv[i + 1].put_pointer(0, FFI::MemoryPointer.from_string(arg.to_s))
354
355
  end
355
- argv[args.size].put_pointer(0, nil)
356
+ argv[args.size + 1].put_pointer(0, nil)
356
357
 
357
- r = Libc.execv(path, argv)
358
+ Libc.execv(path, argv)
358
359
  # if this ever returns, there's been an error
359
360
  raise SystemCallError(:execv, FFI.errno)
360
361
  end
@@ -10,6 +10,7 @@ module Ragweed::Wraptux
10
10
  attach_function 'kill', [ :int, :int ], :int
11
11
  attach_function 'malloc', [ :size_t ], :pointer
12
12
  attach_function 'free', [ :pointer ], :void
13
+ attach_function 'execv', [ :pointer, :pointer ], :int
13
14
  end
14
15
 
15
16
  class PTRegs < FFI::Struct
@@ -68,5 +69,21 @@ module Ragweed::Wraptux
68
69
  #raise SystemCallError.new "ptrace", FFI.errno if r == -1 and !FFI.errno.zero?
69
70
  r
70
71
  end
72
+
73
+ # int execv(const char *path, char *const argv[]);
74
+ def execv(path, *args)
75
+ FFI.errno = 0
76
+ args.flatten!
77
+ argv = FFI::MemoryPointer.new(:pointer, args.size + 2)
78
+ argv[0].put_pointer(0, FFI::MemoryPointer.from_string(path.to_s))
79
+ args.each_with_index do |arg, i|
80
+ argv[i + 1].put_pointer(0, FFI::MemoryPointer.from_string(arg.to_s))
81
+ end
82
+ argv[args.size + 1].put_pointer(0, nil)
83
+
84
+ Libc.execv(path, argv)
85
+ # if this returns, an error has occured
86
+ raise SystemCallError :execv, FFI.errno
87
+ end
71
88
  end
72
89
  end
data/ragweed.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ragweed}
8
- s.version = "0.2.7"
8
+ s.version = "0.2.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{tduehr}, %q{struct}, %q{tqbf}]
12
- s.date = %q{2011-12-06}
12
+ s.date = %q{2011-12-12}
13
13
  s.description = %q{General debugging tool written in Ruby for OSX/Win32/Linux}
14
14
  s.email = %q{td@matasano.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ragweed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - tduehr
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-12-06 00:00:00 Z
20
+ date: 2011-12-12 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: ffi