diff options
author | Marco Peereboom <marco@conformal.com> | 2010-02-21 16:09:33 +0000 |
---|---|---|
committer | Marco Peereboom <marco@conformal.com> | 2010-02-21 16:09:33 +0000 |
commit | 78fb9823aa4206d32e06a17dbc0bd34e08a808c6 (patch) | |
tree | 811aeeb729d3e7ff26dbf2f8ebe62de64b70bb72 | |
parent | 2317717534b6891cf5ebcef08d3b488a12191eb3 (diff) | |
download | xombrero-78fb9823aa4206d32e06a17dbc0bd34e08a808c6.tar.gz |
Enforce a valid download dir and use ~ for default
-rw-r--r-- | xxxterm.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c index 0ffcad3..bc57adf 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -1114,6 +1114,7 @@ usage(void) int main(int argc, char *argv[]) { + struct stat sb; char conf[PATH_MAX] = { '\0' }; int c, focus = 1; @@ -1153,12 +1154,18 @@ main(int argc, char *argv[]) if (pwd == NULL) errx(1, "invalid user %d", getuid()); + /* set download dir */ + strlcpy(download_dir, pwd->pw_dir, sizeof download_dir); + /* read config file */ if (strlen(conf) == 0) snprintf(conf, sizeof conf, "%s/.%s", pwd->pw_dir, XT_CONF_FILE); config_parse(conf); + if (stat(download_dir, &sb)) + errx(1, "must specify a valid download_dir"); + create_canvas(); while (argc) { |