plymouth/0001-seats-guard-against-NULL-terminal.patch

65 lines
2.3 KiB
Diff
Raw Normal View History

From a6eff09852c2eb4d684526b814d2b2df578938d0 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 12 Jun 2014 18:51:24 +0200
Subject: [PATCH] seats: guard against NULL terminal
---
src/libply-splash-core/ply-keyboard.c | 7 +++++--
src/libply-splash-core/ply-seat.c | 6 +++---
src/libply-splash-core/ply-terminal.c | 11 +++++++----
3 files changed, 15 insertions(+), 9 deletions(-)
Index: plymouth-0.9.2/src/libply-splash-core/ply-seat.c
===================================================================
--- plymouth-0.9.2.orig/src/libply-splash-core/ply-seat.c
+++ plymouth-0.9.2/src/libply-splash-core/ply-seat.c
@@ -101,10 +101,10 @@ add_text_displays (ply_seat_t *seat)
{
ply_text_display_t *display;
- if (!ply_terminal_is_open (seat->terminal)) {
- if (!ply_terminal_open (seat->terminal)) {
+ if (!seat->terminal || !ply_terminal_is_open (seat->terminal)) {
+ if (!seat->terminal || !ply_terminal_open (seat->terminal)) {
ply_trace ("could not add terminal %s: %m",
- ply_terminal_get_name (seat->terminal));
+ seat->terminal ? ply_terminal_get_name (seat->terminal) : "none");
return;
}
}
Index: plymouth-0.9.2/src/libply-splash-core/ply-terminal.c
===================================================================
--- plymouth-0.9.2.orig/src/libply-splash-core/ply-terminal.c
+++ plymouth-0.9.2/src/libply-splash-core/ply-terminal.c
@@ -639,24 +639,27 @@ ply_terminal_get_fd (ply_terminal_t *ter
bool
ply_terminal_is_vt (ply_terminal_t *terminal)
{
- return terminal->vt_number > 0;
+ return terminal ? terminal->vt_number > 0 : false;
}
bool
ply_terminal_is_open (ply_terminal_t *terminal)
{
- return terminal->is_open;
+ return terminal ? terminal->is_open : false;
}
bool
ply_terminal_is_active (ply_terminal_t *terminal)
{
- return terminal->is_active;
+ return terminal ? terminal->is_active : false;
}
void
ply_terminal_close (ply_terminal_t *terminal)
{
+ if (!terminal)
+ return;
+
if (!terminal->is_open) {
ply_trace ("terminal %s is already closed", terminal->name);
return;