[LON-CAPA-cvs] cvs: loncom / lond
matthew
lon-capa-cvs@mail.lon-capa.org
Sun, 03 Apr 2005 19:33:34 -0000
matthew Sun Apr 3 15:33:34 2005 EDT
Modified files:
/loncom lond
Log:
Rewrote CopyFile to use File::Copy.
Index: loncom/lond
diff -u loncom/lond:1.280 loncom/lond:1.281
--- loncom/lond:1.280 Thu Mar 3 18:21:51 2005
+++ loncom/lond Sun Apr 3 15:33:34 2005
@@ -2,7 +2,7 @@
# The LearningOnline Network
# lond "LON Daemon" Server (port "LOND" 5663)
#
-# $Id: lond,v 1.280 2005/03/03 23:21:51 matthew Exp $
+# $Id: lond,v 1.281 2005/04/03 19:33:34 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,7 +58,7 @@
my $status='';
my $lastlog='';
-my $VERSION='$Revision: 1.280 $'; #' stupid emacs
+my $VERSION='$Revision: 1.281 $'; #' stupid emacs
my $remoteVERSION;
my $currenthostid="default";
my $currentdomainid;
@@ -472,39 +472,11 @@
my ($oldfile, $newfile) = @_;
- # The file must exist:
-
- if(-e $oldfile) {
-
- # Read the old file.
-
- my $oldfh = IO::File->new("< $oldfile");
- if(!$oldfh) {
- return 0;
- }
- my @contents = <$oldfh>; # Suck in the entire file.
-
- # write the backup file:
-
- my $newfh = IO::File->new("> $newfile");
- if(!(defined $newfh)){
- return 0;
- }
- my $lines = scalar @contents;
- for (my $i =0; $i < $lines; $i++) {
- print $newfh ($contents[$i]);
- }
-
- $oldfh->close;
- $newfh->close;
-
- chmod(0660, $newfile);
-
- return 1;
-
- } else {
- return 0;
+ if (! copy($oldfile,$newfile)) {
+ return 0;
}
+ chmod(0660, $newfile);
+ return 1;
}
#
# Host files are passed out with externally visible host IPs.