Commit Diff
Diff:
0c4b2feaac7334c0ef11355e6871b0396579ed07
e5de9347f708792a7ea7b293f3539b3ae34268d8
Commit:
e5de9347f708792a7ea7b293f3539b3ae34268d8
Tree:
6cb25b485ef02e4ce4eb7436b61a6e98ecbf5154
Author:
jrmu <jrmu@ircnow.org>
Committer:
jrmu <jrmu@ircnow.org>
Date:
Tue Mar 7 15:46:26 2023 UTC
Message:
Make writes safer with backups
blob - 593d7626fde38c45f380c5ebda7690fe4b17e0cf
blob + d5722b6ec40404ce17a8e4a369b0bb6935abe7e6
--- botnow
+++ botnow
@@ -39,7 +39,7 @@ sub readstr {
sub writefile {
my ($filename, $str) = @_;
my $date = date();
- copy($filename, basename($filename).date()) or die "Could not make backup of $filename";
+ copy($filename, "/home/botnow/".basename($filename).date()) or die "Could not make backup of $filename";
open(my $fh, '>', "$filename") or die "Could not write to $filename";
print $fh $str;
close $fh;
@@ -82,6 +82,7 @@ return "true";
# Path to configuration file
my $confpath = "botnow.conf";
+my $homepath = "/home/botnow";
# Configuration variables will be stored in key => value pairs
our %conf;
@@ -197,6 +198,7 @@ my $expires = $conf{expires};
unveil("./", "r") or die "Unable to unveil $!";
unveil("$confpath", "r") or die "Unable to unveil $!";
+unveil("$homepath", "rwc") or die "Unable to unveil $!";
unveil() or die "Unable to lock unveil $!";
#dns and inet for sockets, proc and exec for figlet
IRCNow