diff options
author | Sander Kleijwegt <sander@myowndomain.nl> | 2015-08-19 17:59:35 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-19 10:11:31 -0700 |
commit | b84e6dfc8a288e89cebd38e3e4066a0572c4d1ff (patch) | |
tree | afb9e1762c0d43baa312699ffff50330d2a6cd41 | |
parent | 953470d945ffd3a8c196e1649d1ea025c4775c22 (diff) | |
download | subsurface-b84e6dfc8a288e89cebd38e3e4066a0572c4d1ff.tar.gz |
Fix startup crash with missing HOME or LOGNAME environment variables
Check whether setenv returns NULL and if so default to '~' for HOME
and 'default' for LOGNAME.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | linux.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -55,7 +55,11 @@ const char *system_default_filename(void) int len; home = getenv("HOME"); + if (!home) + home = "~"; user = getenv("LOGNAME"); + if (!user) + user = "default"; len = strlen(home) + strlen(user) + 17; buffer = malloc(len); snprintf(buffer, len, "%s/subsurface/%s.xml", home, user); |