2014-06-20 14:36:53 +02:00
|
|
|
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(-)
|
|
|
|
|
2016-01-13 19:15:35 +01:00
|
|
|
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)
|
2014-06-20 14:36:53 +02:00
|
|
|
{
|
2016-01-13 19:15:35 +01:00
|
|
|
ply_text_display_t *display;
|
2014-06-20 14:36:53 +02:00
|
|
|
|
2016-01-13 19:15:35 +01:00
|
|
|
- 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;
|
|
|
|
}
|
2014-06-20 14:36:53 +02:00
|
|
|
}
|
2016-01-13 19:15:35 +01:00
|
|
|
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
|
2014-06-20 14:36:53 +02:00
|
|
|
bool
|
|
|
|
ply_terminal_is_vt (ply_terminal_t *terminal)
|
|
|
|
{
|
2016-01-13 19:15:35 +01:00
|
|
|
- return terminal->vt_number > 0;
|
|
|
|
+ return terminal ? terminal->vt_number > 0 : false;
|
2014-06-20 14:36:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ply_terminal_is_open (ply_terminal_t *terminal)
|
|
|
|
{
|
2016-01-13 19:15:35 +01:00
|
|
|
- return terminal->is_open;
|
|
|
|
+ return terminal ? terminal->is_open : false;
|
2014-06-20 14:36:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ply_terminal_is_active (ply_terminal_t *terminal)
|
|
|
|
{
|
2016-01-13 19:15:35 +01:00
|
|
|
- return terminal->is_active;
|
|
|
|
+ return terminal ? terminal->is_active : false;
|
2014-06-20 14:36:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ply_terminal_close (ply_terminal_t *terminal)
|
|
|
|
{
|
2016-01-13 19:15:35 +01:00
|
|
|
+ if (!terminal)
|
|
|
|
+ return;
|
2014-06-20 14:36:53 +02:00
|
|
|
+
|
2016-01-13 19:15:35 +01:00
|
|
|
if (!terminal->is_open) {
|
|
|
|
ply_trace ("terminal %s is already closed", terminal->name);
|
|
|
|
return;
|