]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[terminal] guard open and close against repeated calls
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 05:06:11 +0000 (05:06 +0000)
committerScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 20:01:31 +0000 (20:01 +0000)
Since we have a status flag whether or not the terminal fd is open,
use it in the open and close functions to guard against repeated
calls.

src/libply-splash-core/ply-terminal.c

index aeb6159be8537c65248f7817122c31f94962ecb3..4b4b28714e1209d26b9548f75336949fc5008ba7 100644 (file)
@@ -436,6 +436,9 @@ ply_terminal_open (ply_terminal_t *terminal)
 {
   assert (terminal != NULL);
 
+  if (terminal->is_open)
+    return true;
+
   ply_trace ("trying to open terminal '%s'", terminal->name);
 
   if (!ply_terminal_open_device (terminal))
@@ -497,6 +500,9 @@ ply_terminal_is_active (ply_terminal_t *terminal)
 void
 ply_terminal_close (ply_terminal_t *terminal)
 {
+  if (!terminal->is_open)
+    return;
+
   terminal->is_open = false;
 
   ply_terminal_stop_watching_for_vt_changes (terminal);