work around CGI::Session constructor issues
The constructor can fail with a useless error message if module fail to load. Work around this by evaling it, and checking for failures, and printing CGI::Session->errstr to get a more useful message.master
parent
f00e5a8a89
commit
5d26ded381
|
@ -645,8 +645,14 @@ sub cgi_getsession ($) { #{{{
|
|||
CGI::Session->name("ikiwiki_session_".encode_utf8($config{wikiname}));
|
||||
|
||||
my $oldmask=umask(077);
|
||||
my $session = CGI::Session->new("driver:DB_File", $q,
|
||||
{ FileName => "$config{wikistatedir}/sessions.db" });
|
||||
my $session = eval {
|
||||
CGI::Session->new("driver:DB_File", $q,
|
||||
{ FileName => "$config{wikistatedir}/sessions.db" })
|
||||
};
|
||||
if (! $session || $@) {
|
||||
error($@." ".CGI::Session->errstr());
|
||||
}
|
||||
|
||||
umask($oldmask);
|
||||
|
||||
return $session;
|
||||
|
|
Loading…
Reference in New Issue