clonefile 0.5.0 → 0.5.1

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
  SHA256:
3
- metadata.gz: 0bbe04002c44e0fe93d3b88c8cc914ef6cb6f4168a2bf8b3a25fb3f233e3e4c9
4
- data.tar.gz: 13c886537a158e1fb4b44995bac5e8b2b9d5f498e8a8f955b12f8a888fbab7be
3
+ metadata.gz: 701af6bc1b8fa5263ae5080c8663cbdc58958b657da304ef97d08adfc212d2c7
4
+ data.tar.gz: 2a75a943a4fb26fd8b825dbac4a47869735d45de439f491ffdffc5d04b3a9701
5
5
  SHA512:
6
- metadata.gz: ad10432424d32fc3a2419df7ad5f2818ef2e73a11d68d4963b2d894fd8027326a67366c003fdc0609e0fe7cd90de51d0581ed45d02c12e8283f1dc6c3962609d
7
- data.tar.gz: b34234b63f61330c23ed4907a32301ce5ba30cace3cfd6529b58ca9817d7f01582a313fc1737b35d7ac67e5ff6b1c18bdd0f75592bf2f5ab3ada52b2f7bf7cc5
6
+ metadata.gz: 13bac251475f1f4f99fa51249c4e434b860ab75c9e5bde02be404cadfd45fa4b5217013336df45eec5246a1470c92ad132898da5565511a43bb7d5c1025646d0
7
+ data.tar.gz: f67ea20ad3a7548faae3db15a8a15d5eff770974aa6a45592369823ce83b9536a855b97f432d11461e26e40939581b5e852fc5c96ae353bd6a8f869eaf6792c8
@@ -29,7 +29,7 @@ VALUE rb_clonefile(VALUE self, VALUE src, VALUE dest)
29
29
  void Init_clonefile()
30
30
  {
31
31
  rb_mod = rb_define_module("Clonefile");
32
-
32
+
33
33
  rb_define_module_function(rb_mod, "darwin_clonefile", rb_clonefile, 2);
34
34
  }
35
35
 
@@ -10,9 +10,16 @@ module Clonefile
10
10
  if RUBY_PLATFORM =~ /darwin/
11
11
  darwin_clonefile(src, dest)
12
12
  elsif RUBY_PLATFORM =~ /linux/
13
- src_fd = IO.sysopen(src, File::RDONLY | File::BINARY)
14
- dest = File.new(dest, File::WRONLY | File::BINARY | File::CREAT)
15
- dest.ioctl(LINUX_IOCTL_FICLONE, src_fd).zero?
13
+ begin
14
+ src_fd = IO.sysopen(src, File::RDONLY | File::BINARY)
15
+ dest_f = File.new(dest, File::WRONLY | File::BINARY | File::CREAT)
16
+ res = dest_f.ioctl(LINUX_IOCTL_FICLONE, src_fd) == 0
17
+ ensure
18
+ (src_f = IO.new(src_fd)) && src_f.close
19
+ dest_f.close
20
+ end
21
+
22
+ res
16
23
  end
17
24
  end
18
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clonefile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Aleksandersen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Copy files using reflink/cloned extents on supported file systems. Supports
14
14
  Linux and macOS.
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements:
47
- - Linux 4.9.1+ or macOS 10.12.1.
47
+ - Linux 4.9.1+ or macOS 10.12.1+.
48
48
  - " A copy-on-write file system."
49
49
  rubygems_version: 3.1.2
50
50
  signing_key: