Mercurial > trustbridge
diff cinst/nssstore_linux.c @ 975:b3695a3399de
(issue86) Install into default directories on Linux
If the mozilla process is now started as root it will
try to write into the default directories for NSS Shared
and mozilla / thunderbird profiles.
Cinst will now start the mozilla process once as root.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 29 Aug 2014 12:59:44 +0200 |
parents | dbf5ea18cb20 |
children | 78798d3af8f0 |
line wrap: on
line diff
--- a/cinst/nssstore_linux.c Fri Aug 29 10:26:10 2014 +0200 +++ b/cinst/nssstore_linux.c Fri Aug 29 12:59:44 2014 +0200 @@ -201,18 +201,19 @@ { struct passwd *usr_it = NULL; uid_t my_uid = geteuid(); + pid_t childprocess = -1; + int status = -1; if (my_uid != 0) { /* Running as a user */ char *homedir = getenv ("HOME"); - pid_t childprocess = -1; /* Only one child for single user installation */ - int status = -1; if (!homedir) { ERRORPRINTF ("Failed to find home directory\n"); } + /* Only one child for single user installation */ childprocess = start_procces_for_user (to_install, to_remove, my_uid, getgid(), homedir); @@ -232,6 +233,23 @@ return 0; } + /* Start once as root to install in the system default directories. */ + childprocess = start_procces_for_user (to_install, to_remove, + my_uid, getgid(), getenv ("HOME")); + if (childprocess == -1) + { + ERRORPRINTF ("Failed to start default profile installation!\n"); + return -1; + } + + /* Wait until the default profile directories are done. */ + childprocess = waitpid (childprocess, &status, 0); + if (childprocess == -1 || !WIFEXITED(status)) + { + ERRORPRINTF ("Child process did not finish.\n"); + return -1; + } + setpwent(); while ((usr_it = getpwent ()) != NULL)