aboutsummaryrefslogtreecommitdiff
path: root/readConfig.c
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-09-07 03:50:59 +0200
committerache <ache@ache.one>2019-09-07 03:50:59 +0200
commitbd61c8e48e6eea67190d164de4c960e50bb3909e (patch)
tree07af0e5a0f21c14cd6fc2eeb8e7b8c1e268ee975 /readConfig.c
parentOups sms.o (diff)
Better detect user HOME
Diffstat (limited to 'readConfig.c')
-rw-r--r--readConfig.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/readConfig.c b/readConfig.c
index 3640f65..3497b0e 100644
--- a/readConfig.c
+++ b/readConfig.c
@@ -48,7 +48,14 @@ int searchConfigFile(char* configFile) {
#endif
// Home first
- sprintf(path, "%s/.mesmsrc", getenv("HOME"));
+ char* home;
+ struct passwd* pw = getpwuid(getuid());
+ home = pw->pw_dir;
+
+ if( !*home )
+ home = getenv("HOME");
+
+ sprintf(path, "%s/.mesmsrc", home);
f_canRead = fopen(path, "r");
if( f_canRead ) {