summaryrefslogtreecommitdiff
path: root/bin/mapsecrets2access_user
diff options
context:
space:
mode:
authorivan <ivan>2006-06-19 12:47:55 +0000
committerivan <ivan>2006-06-19 12:47:55 +0000
commit3489c3e13d952972c06b82d1eb2bbd0315ed5a7c (patch)
tree71c22bc9181f1dd91282c901779235099c377ddb /bin/mapsecrets2access_user
parent637378f8fa3c8d76a009cbf92984cdfb571cc5ee (diff)
better error checking for this thrown-together bootstrapping script
Diffstat (limited to 'bin/mapsecrets2access_user')
-rwxr-xr-xbin/mapsecrets2access_user7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/mapsecrets2access_user b/bin/mapsecrets2access_user
index b34e0321a..3fcd5069b 100755
--- a/bin/mapsecrets2access_user
+++ b/bin/mapsecrets2access_user
@@ -46,7 +46,7 @@ unless ( $supergroup ) {
my $supergroupnum = $supergroup->groupnum;
my $mapsecrets = '/usr/local/etc/freeside/mapsecrets';
-open(MAPSECRETS, "<$mapsecrets");
+open(MAPSECRETS, "<$mapsecrets") or die $!;
while (<MAPSECRETS>) {
/([\w]+)\s+secrets\s*$/ or die "unparsable line in mapsecrets: $_";
my $username = $1;
@@ -70,9 +70,10 @@ while (<MAPSECRETS>) {
die $aug_error if $aug_error;
}
+close MAPSECRETS;
# okay to clobber mapsecrets now i guess
cp $mapsecrets, "$mapsecrets.bak$$";
-open(MAPSECRETS, ">$mapsecrets");
+open(MAPSECRETS, ">$mapsecrets") or die $!;
print MAPSECRETS '* secrets'. "\n";
-close MAPSECRETS;
+close MAPSECRETS or die $!;