OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 25-Nov-2002 17:51:00
Branch: HEAD Handle: 2002112516505900
Modified files:
openpkg-re openpkg-index
Log:
write temporary file and rename later
Summary:
Revision Changes Path
1.21 +11 -5 openpkg-re/openpkg-index
____________________________________________________________________________
Index: openpkg-re/openpkg-index
============================================================
$ cvs diff -u -r1.20 -r1.21 openpkg-index
--- openpkg-re/openpkg-index 25 Nov 2002 15:57:28 -0000 1.20
+++ openpkg-re/openpkg-index 25 Nov 2002 16:50:59 -0000 1.21
@@ -810,7 +810,7 @@
#####################################################################
-my($prefix,$list,$fh,%cache);
+my($prefix,$list,$fh,%cache,$tmpo);
if ($#ARGV < 0) {
print "usage: $0 [-r resource] [-p platform] [-C cache.db] [-o index.rdf] [-c]
[-i] dir ...\n";
@@ -827,12 +827,13 @@
$opt_p = 'unknown' unless defined $opt_p;
if (defined $opt_o) {
+ $tmpo = $opt_o . '.tmp';
if ($opt_c) {
- $fh = new FileHandle "| $BZ -c > '$opt_o'"
- or die "FATAL: cannot write '$opt_o' ($!)\n";
+ $fh = new FileHandle "| $BZ -c > '$tmpo'"
+ or die "FATAL: cannot write '$tmpo' ($!)\n";
} else {
- $fh = new FileHandle "> $opt_o"
- or die "FATAL: cannot write '$opt_o' ($!)\n";
+ $fh = new FileHandle "> $tmpo"
+ or die "FATAL: cannot write '$tmpo' ($!)\n";
}
} else {
if ($opt_c) {
@@ -858,3 +859,8 @@
$fh->close
or die "FATAL: write error on output ($!)\n";
+
+if (defined $tmpo) {
+ rename $tmpo,$opt_o
+ or die "FATAL: cannot rename $tmpo to $opt_o ($!)\n";
+}
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]