mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 05:45:42 +03:00
Read $HOME variable first before checking the password file entry.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
parent
8e64584c12
commit
f292c01eac
1 changed files with 8 additions and 5 deletions
|
@ -92,13 +92,16 @@ char *csync_get_user_home_dir(void) {
|
|||
char buf[NSS_BUFLEN_PASSWD];
|
||||
int rc;
|
||||
|
||||
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
|
||||
if (rc != 0) {
|
||||
szPath = getenv("HOME");
|
||||
return szPath ? c_strdup(szPath) : NULL;
|
||||
szPath = getenv("HOME");
|
||||
if( szPath ) {
|
||||
return c_strdup(szPath);
|
||||
}
|
||||
|
||||
szPath = c_strdup(pwd.pw_dir);
|
||||
/* Still nothing found, read the password file */
|
||||
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
|
||||
if (rc != 0) {
|
||||
szPath = c_strdup(pwd.pw_dir);
|
||||
}
|
||||
|
||||
return szPath;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue