summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--seq.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/seq.c b/seq.c
index 75f9e3c..159c81c 100644
--- a/seq.c
+++ b/seq.c
@@ -24,8 +24,15 @@ blaze822_home_file(char *basename)
 
 	if (!homedir)
 		homedir = getenv("HOME");
+	if (homedir && !*homedir)
+		homedir = 0;
+	if (!homedir) {
+		struct passwd *pw = getpwuid(getuid());
+		if (pw)
+			homedir = pw->pw_dir;
+	}
 	if (!homedir)
-		homedir = getpwuid(getuid())->pw_dir;
+		return "/dev/null/homeless";
 
 	snprintf(path, sizeof path, "%s/%s", homedir, basename);