From 66e813b88b55b581af1760e299ee30cde70343d1 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 29 Dec 2017 20:09:19 +0000 Subject: If the replacement window manager fails to start, restart the fallback (the original invocation of cwm). --- calmwm.c | 7 ++++++- util.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/calmwm.c b/calmwm.c index ff4568b..319beae 100644 --- a/calmwm.c +++ b/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.c,v 1.105 2017/12/27 18:46:18 okan Exp $ + * $OpenBSD: calmwm.c,v 1.106 2017/12/29 20:09:19 okan Exp $ */ #include @@ -56,6 +56,7 @@ main(int argc, char **argv) { const char *conf_file = NULL; char *conf_path, *display_name = NULL; + char *fallback; int ch, xfd; struct pollfd pfd[1]; struct passwd *pw; @@ -64,6 +65,7 @@ main(int argc, char **argv) warnx("no locale support"); mbtowc(NULL, NULL, MB_CUR_MAX); + fallback = u_argv(argv); Conf.wm_argv = u_argv(argv); while ((ch = getopt(argc, argv, "c:d:")) != -1) { switch (ch) { @@ -132,6 +134,9 @@ main(int argc, char **argv) if (cwm_status == CWM_EXEC_WM) u_exec(Conf.wm_argv); + warnx("'%s' failed to start, restarting fallback", Conf.wm_argv); + u_exec(fallback); + return(0); } diff --git a/util.c b/util.c index e74797e..174a542 100644 --- a/util.c +++ b/util.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: util.c,v 1.18 2015/09/16 17:58:25 okan Exp $ + * $OpenBSD: util.c,v 1.19 2017/12/29 20:09:19 okan Exp $ */ #include @@ -78,7 +78,7 @@ u_exec(char *argstr) (void)setsid(); (void)execvp(args[0], args); - err(1, "%s", s); + warn("%s", s); } char * -- cgit v1.2.3-2-gb3c3