e$B@.@%$G$9!#e(B
e$B$^$:!“e(Bpstore.rb e$B$Ge(B binary mode e$B$X$N$7K:$l$,$”$j$^$9!#e(B
diff -u -r1.27 pstore.rb
— pstore.rb 5 Feb 2006 05:28:11 -0000 1.27
+++ pstore.rb 7 Sep 2006 02:28:40 -0000
@@ -297,7 +297,14 @@
file = File.open(@filename, File::RDONLY)
file.binmode
file.flock(File::LOCK_SH)
-
content = (File.read(new_file) rescue file.read())
-
begin
-
File.open(new_file, "r") {|n|
-
n.binmode
-
content = n.read
-
}
-
rescue
-
content = file.read()
-
end rescue Errno::ENOENT content = "" end
e$B9T?t$,A}$($F$7$^$C$FHa$7$$%Q%C%A$J$N$G$9$,!"e(B
[ruby-dev:28720] e$B$Ne(B IO.read e$B$NOC$O?JE8$J$7$G$9$+!)e(B
e$B$5$F!"K?$A$c$s$M$k$Ge(B PStore e$B$,OCBj$K$J$C$F$$$^$9$,!"e(B
f.binmode e$B$,8z$+$J$$!)e(B
http://pc8.2ch.net/test/read.cgi/tech/1147935007/81
e$B0JA0$+$ie(B PStore
e$B$O?.Mj@-$,$$$^$$$A$H$$$&OC$r7QB3E*$KJ9$-$^$9$7!“e(B
e$B%G!<%?$,2u$l$?7P83$b2?EY$+$”$j$^$9!#e(B
e$B$=$3$G!"$A$c$s$H=q$-9~$a$?$+3NG’$9$k$h$&$K$7$^$;$s$+!#e(B
e$B:#2s$N7o$J$i$P!"e(B
diff -u -r1.27 pstore.rb
— pstore.rb 5 Feb 2006 05:28:11 -0000 1.27
+++ pstore.rb 7 Sep 2006 02:22:58 -0000
@@ -330,6 +330,10 @@
t.binmode
t.write(content)
}
-
File.open(tmp_file, "r") {|t|
-
t.binmode
-
raise unless md5 == Digest::MD5.digest(t.read)
-
} File.rename(tmp_file, new_file) commit_new(file) end
e$B$G!"?7$?$J%G!<%?$O<:$C$F$b!"4{B8$N%G!<%?$O0];}$G$-$k$+$J$H!#e(B
e$B$^$?!"2?%P%$%H$+$4$H$Ke(B chksum e$B$D$1$k$H$+!"e(B
e$B2?$i$+$N%(%i!<D{@5Id9f$r$D$1$i$l$k$H$@$$$V?.Mj@-$,>e$,$k$H;W$&$N$G$9$,!#e(B