summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-08-02 16:57:44 +0000
committerThierry Vignaud <tv@mandriva.org>2007-08-02 16:57:44 +0000
commit9f7389afcef27584e94bb586f1d318486945c44d (patch)
treec8d65c775b5a20789786b36d2f40dcc91e2218d0
parent85be1cc2d05ba4d2c3483023426e4878abd52807 (diff)
downloaddrakx-9f7389afcef27584e94bb586f1d318486945c44d.tar
drakx-9f7389afcef27584e94bb586f1d318486945c44d.tar.gz
drakx-9f7389afcef27584e94bb586f1d318486945c44d.tar.bz2
drakx-9f7389afcef27584e94bb586f1d318486945c44d.tar.xz
drakx-9f7389afcef27584e94bb586f1d318486945c44d.zip
fix crash if /var/log/explanations doesn't exist (#32234)
-rwxr-xr-xperl-install/standalone/logdrake12
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/standalone/logdrake b/perl-install/standalone/logdrake
index fbbdaa3bf..deee52441 100755
--- a/perl-install/standalone/logdrake
+++ b/perl-install/standalone/logdrake
@@ -241,7 +241,7 @@ sub parse_file {
$ey = $months[$month] . "\\s{1,2}$day\\s.*$ey.*\n";
}
- my @all = catMaybeCompressed($file);
+ my @all = -e $file ? catMaybeCompressed($file) : N("Sorry, log file isn't available!");
if ($isExplain) {
my (@t, $t);
@@ -278,7 +278,7 @@ sub parse_file {
if ($isTail) {
close $F if $F;
- open $F, $file or die "E: $!";
+ if (open $F, $file) {
local $_;
while (<$F>) {} #to prevent to output the file twice..
# $log_text->set_point($log_text->get_length());
@@ -286,6 +286,14 @@ sub parse_file {
logcolorize($_) while <$F>;
seek $F, 0, 1;
});
+ } else {
+ my $error = $!;
+ my $string = chomp_(`LC_ALL=C date '+%b %d %T'`) . " " .
+ N("Error while opening \"%s\" log file: %s\n", $file, $error);
+ # `` return non utf8 and concat of non utf8 & utf8 is non utf8:
+ c::set_tagged_utf8($string);
+ logcolorize($string);
+ }
}
insert_text_n_scroll();
}