tarruby 0.1.2-mswin32 → 0.1.3-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/ext/tarruby.c CHANGED
@@ -8,6 +8,7 @@
8
8
  #endif
9
9
  #include "libtar.h"
10
10
  #include "ruby.h"
11
+ #include "rubysig.h"
11
12
 
12
13
  #ifndef RSTRING_PTR
13
14
  #define RSTRING_PTR(s) (RSTRING(s)->ptr)
@@ -32,7 +33,7 @@
32
33
 
33
34
  #define INT2TIME(i) rb_funcall(rb_cTime, rb_intern("at"), 1, INT2NUM(i))
34
35
 
35
- #define VERSION "0.1.2"
36
+ #define VERSION "0.1.3"
36
37
 
37
38
  static VALUE Tar;
38
39
  static VALUE Error;
@@ -275,6 +276,7 @@ static VALUE tarruby_append_tree(int argc, VALUE *argv, VALUE self) {
275
276
  VALUE realdir, savedir;
276
277
  struct tarruby_tar *p_tar;
277
278
  char *s_realdir, *s_savedir = NULL;
279
+ int result = -1;
278
280
 
279
281
  rb_scan_args(argc, argv, "11", &realdir, &savedir);
280
282
  Check_Type(realdir, T_STRING);
@@ -289,7 +291,11 @@ static VALUE tarruby_append_tree(int argc, VALUE *argv, VALUE self) {
289
291
 
290
292
  Data_Get_Struct(self, struct tarruby_tar, p_tar);
291
293
 
292
- if (tar_append_tree(p_tar->tar, s_realdir, s_savedir) != 0) {
294
+ TRAP_BEG;
295
+ result = tar_append_tree(p_tar->tar, s_realdir, s_savedir);
296
+ TRAP_END;
297
+
298
+ if (result != 0) {
293
299
  rb_raise(Error, "Append tree failed: %s", strerror(errno));
294
300
  }
295
301
 
@@ -343,6 +349,7 @@ static VALUE tarruby_extract_glob(int argc, VALUE *argv, VALUE self) {
343
349
  VALUE globname, prefix;
344
350
  struct tarruby_tar *p_tar;
345
351
  char *s_globname, *s_prefix = NULL;
352
+ int result = -1;
346
353
 
347
354
  rb_scan_args(argc, argv, "11", &globname, &prefix);
348
355
  Check_Type(globname, T_STRING);
@@ -355,7 +362,11 @@ static VALUE tarruby_extract_glob(int argc, VALUE *argv, VALUE self) {
355
362
 
356
363
  Data_Get_Struct(self, struct tarruby_tar, p_tar);
357
364
 
358
- if (tar_extract_glob(p_tar->tar, s_globname, s_prefix) != 0) {
365
+ TRAP_BEG;
366
+ result = tar_extract_glob(p_tar->tar, s_globname, s_prefix);
367
+ TRAP_END;
368
+
369
+ if (result != 0) {
359
370
  rb_raise(Error, "Extract archive failed: %s", strerror(errno));
360
371
  }
361
372
 
@@ -369,6 +380,7 @@ static VALUE tarruby_extract_all(int argc, VALUE *argv, VALUE self) {
369
380
  VALUE prefix;
370
381
  struct tarruby_tar *p_tar;
371
382
  char *s_prefix = NULL;
383
+ int result = -1;
372
384
 
373
385
  rb_scan_args(argc, argv, "01", &prefix);
374
386
 
@@ -379,7 +391,11 @@ static VALUE tarruby_extract_all(int argc, VALUE *argv, VALUE self) {
379
391
 
380
392
  Data_Get_Struct(self, struct tarruby_tar, p_tar);
381
393
 
382
- if (tar_extract_all(p_tar->tar, s_prefix) != 0) {
394
+ TRAP_BEG;
395
+ result = tar_extract_all(p_tar->tar, s_prefix);
396
+ TRAP_END;
397
+
398
+ if (result != 0) {
383
399
  rb_raise(Error, "Extract archive failed: %s", strerror(errno));
384
400
  }
385
401
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: mswin32
6
6
  authors:
7
7
  - winebarrel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-13 00:00:00 +09:00
12
+ date: 2008-09-14 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15