If the replacement window manager fails to start, restart the fallback (the

original invocation of cwm).
This commit is contained in:
okan 2017-12-29 20:09:19 +00:00
commit 15ca9c03ba
2 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,7 @@ main(int argc, char **argv)
{ {
const char *conf_file = NULL; const char *conf_file = NULL;
char *conf_path, *display_name = NULL; char *conf_path, *display_name = NULL;
char *fallback;
int ch, xfd; int ch, xfd;
struct pollfd pfd[1]; struct pollfd pfd[1];
struct passwd *pw; struct passwd *pw;
@ -64,6 +65,7 @@ main(int argc, char **argv)
warnx("no locale support"); warnx("no locale support");
mbtowc(NULL, NULL, MB_CUR_MAX); mbtowc(NULL, NULL, MB_CUR_MAX);
fallback = u_argv(argv);
Conf.wm_argv = u_argv(argv); Conf.wm_argv = u_argv(argv);
while ((ch = getopt(argc, argv, "c:d:")) != -1) { while ((ch = getopt(argc, argv, "c:d:")) != -1) {
switch (ch) { switch (ch) {
@ -132,6 +134,9 @@ main(int argc, char **argv)
if (cwm_status == CWM_EXEC_WM) if (cwm_status == CWM_EXEC_WM)
u_exec(Conf.wm_argv); u_exec(Conf.wm_argv);
warnx("'%s' failed to start, restarting fallback", Conf.wm_argv);
u_exec(fallback);
return(0); return(0);
} }

2
util.c
View File

@ -78,7 +78,7 @@ u_exec(char *argstr)
(void)setsid(); (void)setsid();
(void)execvp(args[0], args); (void)execvp(args[0], args);
err(1, "%s", s); warn("%s", s);
} }
char * char *