From 7d0f324b7a8e009da9fe5d61a60dc1c08526b46d Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 29 Oct 2008 23:26:26 +0100 Subject: Make wmiistatus run all the time and wait for wmii_path to exist Instead of exiting as a file inside wmii_path cannot be opened, we wait until wmii_path is found again (particularly the /rbar part, that is), re-setup our files and continue as if nothing happened. This will make wmiistatus survive restarts of wmii and make it wait for /mnt/wmii to appear when booting up (and wmiistatus gets started before wmii itself) --- config.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 1b6fbec..ff57f66 100644 --- a/config.c +++ b/config.c @@ -109,8 +109,12 @@ int load_configuration(const char *configfile) { OPT("wmii_path") { char *globbed = glob_path(dest_value); - if ((stat(globbed, &stbuf)) == -1) - die("wmii_path contains an invalid path"); + if ((stat(globbed, &stbuf)) == -1) { + fprintf(stderr, "Warning: wmii_path contains an invalid path\n"); + free(globbed); + globbed = strdup(dest_value); + } + fprintf(stderr, "gots path: %s\n", globbed); if (globbed[strlen(globbed)-1] != '/') die("wmii_path is not terminated by /"); wmii_path = globbed; @@ -184,7 +188,7 @@ int load_configuration(const char *configfile) { fclose(handle); if (wmii_path == NULL) - exit(-4); + exit(EXIT_FAILURE); return result; } -- cgit v1.2.3