posix-spawn 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f593fc74a9f8637ea2c1dbfa897a805d6f87c0fe
4
- data.tar.gz: 89a1a14ec837e06d68e85af34e56e956a976df30
3
+ metadata.gz: 5e7aaeb2727c0c2d0d4b1055fee451289ddd510b
4
+ data.tar.gz: 87bcf9d8cc5cd759a6dc985a683b2a6d44dd8152
5
5
  SHA512:
6
- metadata.gz: 33b05adfe9baf71faabd10e25e434c03e6aac674b4d9d05a6b79e1f8972a34aeacba3bb7b40598355fc9aa4c455049eeb0b3f6c00f7790d906f1ef01bb1799fe
7
- data.tar.gz: 75ab91856b7ee41fad74bf2be66096d2667f8fbe888d5c7d67ab364c5033438ceb8e1f1a6b0e9f99cd120da4b65ca9486f2177b1bf4aa51ad7463229102e6dc1
6
+ metadata.gz: 4f94bf7abd676780045ffb4c7d010cb0cc626d1fe6bbe84fab3126c4764a14f3828266db52f5ffa1eed5827ce0cac988b53f443bf9fed2bfd37110f6b55092f5
7
+ data.tar.gz: 20f06443465c1b96e06f988ca0c9b74df329cb13bbc0cb132217fa9453d35680e539de59492bfb2fe65bdd37c5c3d2b36a970899fd5fe860a04c0a9206530a09
data/COPYING CHANGED
@@ -20,9 +20,3 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
20
  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
21
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
-
24
- A small portion of the environ dup'ing code in ext/posix-spawn.c
25
- was taken from glibc <http://www.gnu.org/s/libc/> and is maybe
26
- Copyright (c) 2011 by The Free Software Foundation or maybe
27
- by others mentioned in the glibc LICENSES file. glibc is
28
- distributed under the terms of the LGPL license.
@@ -269,27 +269,22 @@ each_env_check_i(VALUE key, VALUE val, VALUE arg)
269
269
  static int
270
270
  each_env_i(VALUE key, VALUE val, VALUE arg)
271
271
  {
272
- char *name = StringValuePtr(key);
273
- size_t len = strlen(name);
272
+ const char *name = StringValuePtr(key);
273
+ const size_t name_len = strlen(name);
274
274
 
275
- /*
276
- * Delete any existing values for this variable before inserting the new value.
277
- * This implementation was copied from glibc's unsetenv().
278
- */
279
- char **ep = (char **)arg;
280
- while (*ep != NULL)
281
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
282
- {
283
- /* Found it. Remove this pointer by moving later ones back. */
284
- char **dp = ep;
285
-
286
- do
287
- dp[0] = dp[1];
288
- while (*dp++);
289
- /* Continue the loop in case NAME appears again. */
275
+ char **envp = (char **)arg;
276
+ size_t i, j;
277
+
278
+ for (i = 0; envp[i];) {
279
+ const char *ev = envp[i];
280
+
281
+ if (strlen(ev) > name_len && !memcmp(ev, name, name_len) && ev[name_len] == '=') {
282
+ for (j = i; envp[j]; ++j)
283
+ envp[j] = envp[j + 1];
284
+ continue;
290
285
  }
291
- else
292
- ++ep;
286
+ i++;
287
+ }
293
288
 
294
289
  /*
295
290
  * Insert the new value if we have one. We can assume there is space
@@ -301,15 +296,15 @@ each_env_i(VALUE key, VALUE val, VALUE arg)
301
296
  char *cval = StringValuePtr(val);
302
297
 
303
298
  size_t cval_len = strlen(cval);
304
- size_t ep_len = len + 1 + cval_len + 1; /* +2 for null terminator and '=' separator */
299
+ size_t ep_len = name_len + 1 + cval_len + 1; /* +2 for null terminator and '=' separator */
305
300
 
306
301
  /* find the last entry */
307
302
  while (*ep != NULL) ++ep;
308
303
  *ep = malloc(ep_len);
309
304
 
310
- strncpy(*ep, name, len);
311
- (*ep)[len] = '=';
312
- strncpy(*ep + len + 1, cval, cval_len);
305
+ strncpy(*ep, name, name_len);
306
+ (*ep)[name_len] = '=';
307
+ strncpy(*ep + name_len + 1, cval, cval_len);
313
308
  (*ep)[ep_len-1] = 0;
314
309
  }
315
310
 
@@ -373,6 +368,7 @@ rb_posixspawn_pspawn(VALUE self, VALUE env, VALUE argv, VALUE options)
373
368
 
374
369
  if (RHASH_SIZE(env) > 0) {
375
370
  int size = 0;
371
+ char **new_env;
376
372
 
377
373
  char **curr = environ;
378
374
  if (curr) {
@@ -387,7 +383,7 @@ rb_posixspawn_pspawn(VALUE self, VALUE env, VALUE argv, VALUE options)
387
383
  size = 0;
388
384
  }
389
385
 
390
- char **new_env = calloc(size+RHASH_SIZE(env)+1, sizeof(char*));
386
+ new_env = calloc(size+RHASH_SIZE(env)+1, sizeof(char*));
391
387
  for (i = 0; i < size; i++) {
392
388
  new_env[i] = strdup(environ[i]);
393
389
  }
@@ -158,7 +158,7 @@ module POSIX
158
158
 
159
159
  # grab exit status
160
160
  @status = waitpid(pid)
161
- rescue Object => boom
161
+ rescue Object
162
162
  [stdin, stdout, stderr].each { |fd| fd.close rescue nil }
163
163
  if @status.nil?
164
164
  if !@pgroup_kill
@@ -197,7 +197,6 @@ module POSIX
197
197
  def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
198
198
  max = nil if max && max <= 0
199
199
  @out, @err = '', ''
200
- offset = 0
201
200
 
202
201
  # force all string and IO encodings to BINARY under 1.9 for now
203
202
  if @out.respond_to?(:force_encoding) and stdin.respond_to?(:set_encoding)
@@ -1,5 +1,5 @@
1
1
  module POSIX
2
2
  module Spawn
3
- VERSION = '0.3.11'
3
+ VERSION = '0.3.12'
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
 
12
12
  s.authors = ['Ryan Tomayko', 'Aman Gupta']
13
13
  s.email = ['r@tomayko.com', 'aman@tmm1.net']
14
- s.licenses = ['MIT', 'LGPL']
14
+ s.licenses = ['MIT']
15
15
 
16
16
  s.add_development_dependency 'rake-compiler', '0.7.6'
17
17
  s.add_development_dependency 'minitest', '>= 4'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix-spawn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-07 00:00:00.000000000 Z
12
+ date: 2016-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -75,7 +75,6 @@ files:
75
75
  homepage: https://github.com/rtomayko/posix-spawn
76
76
  licenses:
77
77
  - MIT
78
- - LGPL
79
78
  metadata: {}
80
79
  post_install_message:
81
80
  rdoc_options: []
@@ -93,8 +92,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
92
  version: '0'
94
93
  requirements: []
95
94
  rubyforge_project:
96
- rubygems_version: 2.2.2
95
+ rubygems_version: 2.4.5.1
97
96
  signing_key:
98
97
  specification_version: 4
99
98
  summary: posix_spawnp(2) for ruby
100
99
  test_files: []
100
+ has_rdoc: