diff options
author | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2020-11-07 00:10:23 +0100 |
---|---|---|
committer | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2020-11-07 00:10:23 +0100 |
commit | 60a1dd5c1bdd1e7e01167a0033236041beb36800 (patch) | |
tree | 25bf31820ce46f5a84376f3c19940879acbd22ef /xfce4-session | |
parent | a610e77fa488d3beb04229d113cb65ff4a21903c (diff) | |
download | xfce4-session-60a1dd5c1bdd1e7e01167a0033236041beb36800.tar.gz |
Fix potential crash in suspend and shutdown (Fixes #65)
By always setting the GError we avoid NULL pointer dereference and
consequently crashes when failing to lock/suspend/shutdown.
Diffstat (limited to 'xfce4-session')
-rw-r--r-- | xfce4-session/xfsm-shutdown-fallback.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xfce4-session/xfsm-shutdown-fallback.c b/xfce4-session/xfsm-shutdown-fallback.c index 954ab259..ff6b81b8 100644 --- a/xfce4-session/xfsm-shutdown-fallback.c +++ b/xfce4-session/xfsm-shutdown-fallback.c @@ -347,6 +347,8 @@ lock_screen (GError **error) /* sleep 2 seconds so locking has time to startup */ g_usleep (G_USEC_PER_SEC * 2); } + else + g_set_error (error, 1, 0, "Failed to lock the screen."); g_object_unref (G_OBJECT (saver)); @@ -410,6 +412,7 @@ xfsm_shutdown_fallback_try_action (XfsmShutdownType type, return FALSE; break; default: + g_set_error (error, 1, 0, "Unknown shutdown type %d", type); return FALSE; } @@ -429,6 +432,10 @@ xfsm_shutdown_fallback_try_action (XfsmShutdownType type, g_free (command); #endif + if (!ret) + { + g_set_error (error, 1, 0, "Failed to %s (%s)", xfsm_helper_action, cmd); + } return ret; } |