--- xfce4-session-4.12.1/xfce4-session/xfsm-systemd.c 2014-08-28 18:52:46.000000000 +0300 +++ xfsm-systemd.c 2018-09-15 14:12:45.231665058 +0300 @@ -110,13 +110,16 @@ xfsm_systemd_lock_screen (GError **error) { XfconfChannel *channel; - gboolean ret = TRUE; channel = xfsm_open_config (); if (xfconf_channel_get_bool (channel, "/shutdown/LockScreen", FALSE)) - ret = g_spawn_command_line_async ("xflock4", error); - - return ret; + { + gboolean ret; + gint exit_status; + ret = g_spawn_command_line_sync ("xflock4", NULL, NULL, &exit_status, error); + if (ret == FALSE || exit_status != 0) return FALSE; + } + return TRUE; }