Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Dec 1997 18:05:30 -0500 (EST)
From:      Matt Behrens <matt@megaweapon.zigg.com>
To:        questions@freebsd.org
Subject:   perl script trashes master.passwd
Message-ID:  <Pine.BSF.3.96.971217180353.18871A-100000@megaweapon.zigg.com>

next in thread | raw e-mail | index | archive | help
I'm trying to write a short perl script to copy passwords from
/etc/master.passwd to my CVS repository's password file.  When I run this
perl script, though, master.passwd ends up as a zero-length file.  If I
substitute another filename, the script seems to work okay.  Is there some
weird trapdoor on master.passwd?

  Matt Behrens <matt@zigg.com> | Support the anti-spam amendment!
  http://www.zigg.com/         | Visit http://www.cauce.org/

#!/usr/bin/perl
# Make a CVS passwd file from the system passwd file.

$cvsroot="/usr/local/cvs/CVSROOT";

die "can't open master.passwd\n" unless open (SYSPW, "</etc/master.passwd");
umask 077;
die "can't open $cvsroot/passwd\n" unless open (CVSPW, ">$cvsroot/passwd");

while (<SYSPW>) {
   if (/(\S+):(\S+):.+/) {
      print CVSPW "$1:$2\n";
   }
}





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971217180353.18871A-100000>