tdeinit: make lnusertemp respect HOME for root

This resolves bug 2739

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
pull/1/head
Alexander Golubev 8 years ago committed by Slávek Banko
parent e1861cb681
commit d23ac70c47

@ -124,15 +124,16 @@ int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname)
if (kde_home[0] == '~') if (kde_home[0] == '~')
{ {
if (uid == 0) if (!home_dir || !home_dir[0])
{ {
if ( uid == 0 ) {
home_dir = pw_ent->pw_dir ? pw_ent->pw_dir : "/root"; home_dir = pw_ent->pw_dir ? pw_ent->pw_dir : "/root";
} }
if (!home_dir || !home_dir[0]) else {
{
fprintf(stderr, "[lnusertemp] Aborting. $HOME not set!\n"); fprintf(stderr, "[lnusertemp] Aborting. $HOME not set!\n");
return 1; return 1;
} }
}
if (strlen(home_dir) > (PATH_MAX-100)) if (strlen(home_dir) > (PATH_MAX-100))
{ {
fprintf(stderr, "[lnusertemp] Aborting. Home directory path too long!\n"); fprintf(stderr, "[lnusertemp] Aborting. Home directory path too long!\n");

Loading…
Cancel
Save