diff --git a/scripts/lib/SUSE/MyBS.pm b/scripts/lib/SUSE/MyBS.pm index ce9f37d..e429616 100644 --- a/scripts/lib/SUSE/MyBS.pm +++ b/scripts/lib/SUSE/MyBS.pm @@ -287,15 +287,17 @@ sub save_cookie { my ($self, $cookie) = @_; my $fh = $self->{lock}; - print $fh $cookie; + if ($fh) { + print $fh $cookie; - close($fh); + close($fh); - move($self->{cookiefile}, $cookiefile); - unlink($lockfile); + move($self->{cookiefile}, $cookiefile); + unlink($lockfile); - $self->{lock} = undef; - $self->{cookiefile} = undef; + $self->{lock} = undef; + $self->{cookiefile} = undef; + } } sub ssh_auth {